You are on page 1of 1

EXERCISES: Iteration

1. Write a program in C takes any positive integer input, n, and


prints the sum of all the integers from 1 to n.

2. Write a program in C to read 10 numbers from keyboard and find


their sum and average

3. Write a program in C that takes any positive integer input, n,


and displays the standard multiplication table (from 1 to 12)
of that number. For example, if the user enters 6, the program
displays the 6 times table from 1 to 12.

4. Write a program in C to display the pattern of a right-angled


triangle using an asterisk.
The output should look like:
*
**
***
****

5. Write a program in C to print a pyramid pattern using


asterisks.
The output should look like:

*
* *
* * *
* * * *

You might also like