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 best way of making my program efficient?
What is the heap?
Identify the operators that is not used with pointer a. && b. # c. * d. >>
What is the difference between test design and test case design?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
what is purpose of fflush(stdin) function
What are the 5 elements of structure?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
3. Program to print all possible substrings. ex: String S St Str Stri Strin String t tr tri trin tring r
difference between my-strcpy and strcpy ?
3 Answers Geometric Software, IIM, Infosys,
#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
How important is structure in life?