# For Loop

#### for and while Loops

Looping statement are the statements execute one or more statement repeatedly several number of times. In C programming language there are three types of loops:

- For loop
- While loop
- Do while loop

- Multiple initialization and update expression
- Optional expression
- Infinite loop
- Empty loop

int i,j;

for(i=1,j=20; I,=10; i++,j--)

{

printf("%d %d ",i,j)

}

int i=2;

for( ;i<=20;i=i+2)

{

printf("%d",i);

}

int i=2;

for( ;i<=20; )

{

printf(“%d”,i);

i=i+2;

}

int i=2;

for( ; ; )

{

printf(“%d”,i);

i=i+2;

if(i>20)

{

break;

}

}

int I

for(i=1; ;i++)

{

pritlf("%d",i);

}

int i;

for( ; ; )

{

pritlf("%d",i);

}

int i;

for(i=1;i<=i;i++)

{

pritlf("%d",i);

}

int i

for(i=2;i<=50;i++)

{

}

for(i=2;i<=50;i++);

#### C : **For Loop** Program List

**Program [1]**

Write a C Program to Calculate the Sum of Natural Numbers

**Program [2]**

Write a C Program to Find Factorial of a Number

**Program [3]**

Write a C Program to Generate Multiplication Table

**Program [4]**

Write a C Program to Display Fibonacci Sequence

**Program [5]**

Write a C Program to Find GCD of two Numbers

**Program [6]**

Write a C Program to Display Characters from A to Z Using Loop

**Program [7]**

Write a C Program to Check Whether a Number is Prime or Not

**Program [8]**

Write a C Program to Display Factors of a Number

**Program [9]**

Write a ‘C’ program to computer the average of every third integer lying between 1 and 200?

**Program [10]**

Write a program to check whether the given number is Perfect Number or not

Perfect Number :- Perfect number, a positive integer equal to the sum of its proper divisors. The smallest Perfect number is 6, which is the sum of 1, 2 and 3.

For Example:-

Input = 28

Output = 28 is the Perfect Number.

So as we can see that the divisor of 28 is 1, 2, 4, 7, 14, so the sum of all the divisors is 28 (1 + 2 + 4 + 7 + 14 = 28). Therefore, 28 is the Perfect number.