22ADS108 Lecture Notes - Lecture 3: In C, Flowchart, For Loop
Document Summary
Explain while loop in c with flow chart and example. Loop structures while loop: a loop is used for executing a block of statements repeatedly until a given condition returns false. Increment can be done before or after the execution of the statement(s) Program to print the number from 1 to 10 using while loop. #include int main() int i=1; while(i<=10) printf("%d\n",i); i=i+1; Program to print hello world 10 times using while loop. #include int main() int i=1; while(i<=10) printf("hello world!\n"); i++; return 0; Explain for loop in c with flow chart and example. For loop: a for loop is a more efficient loop structure in c" programming. In c programming language for loop is a statement which allows code to be repeatedly executed. It contains 3 parts for loop in c language is used to iterate the statements or a part of the program several times.