-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathunderstanding-while-loop.c
30 lines (27 loc) · 1.44 KB
/
understanding-while-loop.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<stdio.h>
void main()
{
int i;
i=1;
while ( i <= 10 )
{
printf("Now i is %d so accarding to condiction %d <= 10 which is true ",i,i);
printf("so loop will execute it's statements\n");
i = i+1;
}
printf("Now i is %d so accarding to condiction %d <= 10 which is not true ",i,i);
printf("so loop will stop and it's other statements will run");
}
/*
Now i is 1 so accarding to condiction 1 <= 10 which is true so loop will execute it's statements
Now i is 2 so accarding to condiction 2 <= 10 which is true so loop will execute it's statements
Now i is 3 so accarding to condiction 3 <= 10 which is true so loop will execute it's statements
Now i is 4 so accarding to condiction 4 <= 10 which is true so loop will execute it's statements
Now i is 5 so accarding to condiction 5 <= 10 which is true so loop will execute it's statements
Now i is 6 so accarding to condiction 6 <= 10 which is true so loop will execute it's statements
Now i is 7 so accarding to condiction 7 <= 10 which is true so loop will execute it's statements
Now i is 8 so accarding to condiction 8 <= 10 which is true so loop will execute it's statements
Now i is 9 so accarding to condiction 9 <= 10 which is true so loop will execute it's statements
Now i is 10 so accarding to condiction 10 <= 10 which is true so loop will execute it's statements
Now i is 11 so accarding to condiction 11 <= 10 which is not true so loop will stop and it's other statements will run
*/