הלינקייה: מגזין חודשי למפתחים

רוצה לשמוע על כל האירועים, המדריכים, הקורסים והמאמרים שנכתבו החודש ?
הלינקייה הינו מגזין חופשי בעברית שמשאיר אותך בעניינים.
בלי ספאם. בלי שטויות. פעם בחודש אצלך בתיבה.

Programming Exercise 1

Flow Control

For each of the following - write a main function that performs the requested task.

  1. Randomizes three numbers in range (0.. 100) and prints the largest one.
  2. Randomizes a number (range 0..100), then prints all the even numbers from 0 to the randomized.
  3. Randomizes a number (range 0..100), then prints all the odd numbers from 40 to that one. If the number was smaller than 40 nothing should be printed
  4. Randomizes a number (range 0..100), then prints all the odd numbers from 40 to that one. If the number was smaller than 40, print all the numbers down to the randomized one (i.e. if the result was 37, you should print: 40, 39, 38, 37)
  5. Randomizes a number n in range 0..100. Now randomizes n more numbers in that range, printing the largest of them.
  6. Randomizes a number (range 1000 .. 9999 ) and calculate the sum of its digits. For instance, if the randomized number was 1049, program should print 14
  7. Randomizes a number (range 1000..9999) and calculate the sum of its digits repeatedly until you reach one digit only. For instance, if the randomized number was 1049, program should print 5
  8. Randomizes two numbers and prints the smallest number that is greater than one, such that both numbers are divided by it with no remainder. For instance, for 9 and 6 you should print 3. If there isn't one a proper note should be printed.
  9. Randomizes two numbers and prints their least common multiplication of them. (use http://en.wikipedia.org/wiki/Least_common_multiple for details)
  10. Randomizes two numbers and prints their average and standard deviation.

Arrays

  1. Write a program that goes over all command line arguments it got, summing them and prints their sum total
  2. Write a program that goes over all command line arguments and prints the longest one
  3. Write a program that counts for each word it got in the command line arguments, how many times that word was found in the arguments array
  4. Write a program that takes every word it got as a command line argument, take the first letter of each word, and creates a new word from all those first letters.
  5. Write a program that prints all the words it got from command line in reverse order
course: