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
for(i=1,j=20; I,=10; i++,j--)
printf("%d %d ",i,j)
for( ;i<=20; )
for( ; ; )
for( ; ; )
C : For Loop Program List
Write a C Program to Calculate the Sum of Natural Numbers
Write a C Program to Find Factorial of a Number
Write a C Program to Generate Multiplication Table
Write a C Program to Display Fibonacci Sequence
Write a C Program to Find GCD of two Numbers
Write a C Program to Display Characters from A to Z Using Loop
Write a C Program to Check Whether a Number is Prime or Not
Write a C Program to Display Factors of a Number
Write a ‘C’ program to computer the average of every third integer lying between 1 and 200?
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.
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.