This exercise is available at https://study.find-santa.eu/exercises/c/loops/.
For the sake of the environment, please avoid printing these instructions in the future. Thank you!

Loops

  1. Even numbers
    Write a program that prints all even numbers from (including) 10 to (including) 100. Each number should be printed on a separate line.
    Name the source file: even_numbers.c
  2. Alphabet
    Write a program that prints all lower case characters from 'a' to 'z' on a single line without any separator. The program has to print one character at a time using a while loop. Print a newline (\n) character at the end of the sequence.
    Name the source file: alphabet.c
  3. Sum of a Special Sequence
    Write a program that calculates the sum of all odd numbers greater than or equal to 50 and less than 1110 if the numbers can be divided by 3 without a remainder. Print the result to stdout.
    Once you have a working solution, consider if there is a better solution.
    Name the source file: special_sequence_sum.c
  4. Faculty Function
    The faculty of an integral number is the product of all integral numbers between 1 and that number. For example, the faculty of 5 (usually written as 5! is 5 * 4 * 3 * 2 * 1. Write a program that calculates the faculty of 13 (13!) and prints the result to the terminal. Verify that your result is correct!
    Name the source file: faculty.c
  5. Sum of Digits
    For many purposes it is useful to calculate the sum of the digits of a number. For example, the sum of the digits facilitates knowing whether or not a number can be divided by 3. Write a program that asks the user to input a number and calculates the sum of its digits. The sum of the digits has to be printed to stdout.
    A sample run of this program:
    Enter a number: 123
    The sum of the digits in 123 is 1 + 2 + 3 = 6.
    
    Name the source file: digit_sum.c
  6. Sum of a Sequence of Numbers (more generic)
    Writing a program that always computes the same output has very limited utility. Based on your special_sequence_sum.c program write a new program that allows users to enter the lower limit (inclusive) and the upper limit (exclusive) of a sequence of numbers to be summed. Users also have to be able enter a number in case they only want every second / third / fourth / ... number to be summed up. That number has to default to 1. Print the result to stdout.
    Once you have a working solution, consider if there is a better solution.
    A sample run of this program:
    This programs computes the sum of a sequence of numbers.
    Enter the lower limit (inclusive): 123
    Enter the upper limit (exclusive): 456
    Only sum every nth number [default: 1 (every number)]: 100
    The desired sum is 1092.
    
    Note that 1092 is the sum of 123 + 223 + 323 + 423.
    Name the source file: sequence_sum.c