We use loops in program when we need to execute one or more statements multiple times until some conditions are satisfied. Means sometimes we want some part of code to be executed multiple times then we need to use loops.
There are 3 types of loops in C-
1. for loop
2. while loop
Above three type of loops are used in C programming. Using this loops we can execute conditions multiple times. below is the list of for, while and do-while loops in C programming examples.
So let's understand the the working of loops with examples...
Loops Exercises and Example's:
- C program to print 1 to n natural numbers.
- C program to print sum of 1 to n natural numbers.
- C program to print Even number's from 1 to n.
- C program to print odd numbers from 1 to n.
- C program to print multiplication table of given number.
- C program to print Fibonacci series.
- C program to print number while is less than 10.
- C program to print digit sum of given number.
- C program to reverse a given number.
- C program to check given number is palindrome or not.
- C Program to find product of digits of a number.
- C program to print number till it is less than 5 using do-while loop.
- C program using do-while loop to check program is inside or outside the loop.
Next: Array in C