Nested Loops C programming allows you to use one loop inside another loop. The following program will clear your concept. Syntax The syntax for a nested for loop statement in C is as follows − for ( init; condition; increment ) { for ( init; condition; increment ) { statement(s); } statement(s); } The syntax for a nested while loop statement in C programming language is as follows − while(condition) { while(condition) { statement(s); } statement(s); } The syntax for a nested do...while loop statement in C programming language is as follows − do { statement(s); do { statement(s); }while( condition ); }while( condition ); Note:- you can put any type of loop inside any other type of loop. For example, a 'for' loop can be inside a 'while' loop or vice versa. Example ...
- Get link
- X
- Other Apps