C Programming - Control Instructions - Discussion
Discussion Forum : Control Instructions - General Questions (Q.No. 1)
1.
How many times "IndiaBIX" is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IndiaBIX");
}
return 0;
}
Discussion:
142 comments Page 12 of 15.
DKBOSS said:
1 decade ago
This will printed one time ; please check your sequence and then discuss.
Srinu said:
1 decade ago
Break and continue statements does not allow to execute printf statement.
Dharmesh said:
1 decade ago
For printing the statement either it should be in if or in else block.
Aliimran224 said:
1 decade ago
Here,
i = i+2*i+1 [Because i++ = i+1].
Now i = 1+2*1+1.
i = 4(Ans).
i = i+2*i+1 [Because i++ = i+1].
Now i = 1+2*1+1.
i = 4(Ans).
Aashiya said:
2 years ago
Their is 5 times india fix is printed before the break of for loop..
(1)
Gururaj said:
8 years ago
Actlly almost all we are not using -1 for initilizng -1 in for loop.
Ashish Sawant said:
1 decade ago
Here for(x=-1), therefore the IndiaBix is printed 0 times.
Himani said:
1 decade ago
Thanks all of you. You all have cleared my doubt.
Nithin said:
1 decade ago
Will break and exit statements work similarly ?
Prajith&ratnaji said:
1 decade ago
Thank you very much for clearing our doubt.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers