"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
Loops are used in programming to execute or repeat the group of statement or block of statement. Loop execute the block of statement until the condition not go false.
If you don't know number of iteration in advance. How much iteration go long?, then go for while loop condition.
It execute until the condition not go false. Keep preforming iteration until condition not become false.
while(condition) { statement; }
Lets suppose you want to print the number from 1 to 10. You can't write the 10 times printf function to print the all number. It is very time consuming process. To solve this problem we use while loop condition.
#include<stdio.h> #include<conio.h> void main() { int i; while(i<=10) { printf(" %d \n",i); } getch(); }
1 2 3 4 5 6 7 8 9 10