a=0;
while(a<5)
printf("%d\n",a++);
how many times does the loop occurs?
a.infinite
b.5
c.4
d.6
Answers were Sorted based on User's Feedback
Answer / bharath kumar
Hello,
The answer is b.
a=0+1=1
a=1+1=2
a=2+1=3
a=3+1=4
a=4+1=5
While a variable is storing the 5 result a is nither less
then are equal to 5 hence the application will come out of
the loop.So while loop had run 5 times.
| Is This Answer Correct ? | 28 Yes | 4 No |
Answer / vikram
the output will be:
0
1
2
3
4
hence the loop will be executed 5 times,hence the answer is b
| Is This Answer Correct ? | 17 Yes | 2 No |
Answer / deepu_ashu
as the value of "a" increases after printing the value.
so it will print the value
0
1
2
3
4
but after printing the value 4 ,it becomes 5 for the next iteration.
so the condition becomes false.
the loop will not execute any more.
| Is This Answer Correct ? | 12 Yes | 1 No |
Answer / vignesh1988i
THIS LOOP OCCURS 5 TIMES. AT THE SIXTH TIME IT BECOMES FALSE
| Is This Answer Correct ? | 12 Yes | 2 No |
Answer / ankit rastogi
ans should be (a)infinite
bcoz every time a will be initialize with 0......
and increment values are displayed
a=1
a=2
a=3
a=4...................upto infinity......
| Is This Answer Correct ? | 4 Yes | 3 No |
what is the most appropriate way to write a multi-statement macro?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
what is the difference between getch() and getche()?
How can you allocate arrays or structures bigger than 64K?
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? }
14 Answers CDAC, GATE, NDS, TCS,
which header file contains main() function in c?
17 Answers Google, HCL, TCS,
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.
What does volatile do?
What are examples of structures?
write a program to print the one dimensional array.
Write a c program for sum of first n terms of the series S = 1 - (1/3) + (1/5) -(1/7) + (1/9) ......
Why is c called c?