do-while loop in C.

 

01 #include<stdio.h>
02
03 int main()
04 {
05 int i;
06 do
07 {
08 printf("nYou are inside do-while loop.");
09 printf("nPress 1 To Exit from loop. : ");
10 scanf("%d",&i);
11 }
12 while(i!=1);
13 printf("nYou are out of do-while loop.");
14 return 0;
15 }
 
 OUTPUT :


You are inside do-while loop.
Press 1 To Exit from loop. : 2

You are inside do-while loop.
Press 1 To Exit from loop. : 3

You are inside do-while loop.
Press 1 To Exit from loop. : 4

You are inside do-while loop.
Press 1 To Exit from loop. : 1

You are out of do-while loop.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *