Tagged: while statement c

while Statement in C Programming Language 23

while loop in C programming language

In this article, we will understand the while loop in C programming language. Let us suppose you want to execute a block of statement 5 times. There is one approach using goto statement as shown below. #include<stdio.h> #include<conio.h> void main() { int i=0; clrscr(); label1: i=i+1; printf(“%d This will be repeated 5 times\n”, i); if(i!=5) goto label1; printf(“End of the program”); getch(); } Output: 1 This will be repeated 5 times 2 This will be repeated 5 times 3 This will be repeated 5 times 4 This will be repeated 5 times 5 This will be repeated 5 times End...