-
Notifications
You must be signed in to change notification settings - Fork 3
/
testing-loop.c
41 lines (36 loc) · 1002 Bytes
/
testing-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
31
32
33
34
35
36
37
38
39
40
41
//let's play a quiz.
//I will give you code and you have to judge the output.
#include<stdio.h>
void main()
{
int x=1;
while ( x <= 10) // this is our condiction now x is 1 so it's true
// so loop will execute it's statement
{
printf("MY NAME IS VIPIN\n");
x = x+1; // here x become 2
} // after closing of loop block condiction is recheck it will again true
// because x was 2
// same process will go on untill the condiction become falce.
printf("LOOP HAS OVER"); // when x become 11 then condiction become false
// and then other statements will run.
}
/*
cann you gess
if yes than very good
else don't worry
i will tell you
OUTPUT :
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
MY NAME IS VIPIN
LOOP HAS OVER
you see it print MY NAME IS VIPIN 10 times.
*/