Professional Documents
Culture Documents
Department of EEE
CSE 121
L1T1 D (EVE)
Assignment 2
1. Write a C program that takes a number from the user and calculates the factorial of that number
using for loop.
The factorial of a number is defined as:
n! = 1 × 2 × × 3 × … … × n
Example Output
Enter an integer: 5
Factorial of 5 is 120.
2. Write a C program that displays the numbers in the arithmetic progression 1 2 4 8 16, and so on,
upto 1000 using any type of loop.
Output
1
2
4
8
16
…
…
512