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 10 of 15.
Premalatha said:
1 decade ago
Guys please anyone can explain me!!!
void main()
{
int i;
i=1;
i=i+2*i++;
printf("%d",i);
}
Output = 4.
void main()
{
int i;
i=1;
i=i+2*i++;
printf("%d",i);
}
Output = 4.
Chirala anil kumar said:
1 decade ago
In this program increment the x value up to x = 5 after that if condition false come out of the loop. Nothing printed.
Sweety said:
1 decade ago
The statement cannot executed the statement of x so the process of IndianBIX executed the statement executed 0times.
Agi said:
1 decade ago
int i=1
for(i=-1;i<=10;1++)
Then how it calculate -1 in for loop ?
Then how many it print?
Please explain this.
for(i=-1;i<=10;1++)
Then how it calculate -1 in for loop ?
Then how many it print?
Please explain this.
Amol said:
1 decade ago
The continue statement takes the control out of the loop for the next iteration and the break terminates the loop.
Vignatha said:
1 decade ago
Ya after the continue and break stmts nxt part o code z nt xcuted n goes to iteration, for that der z no output.
Mayank said:
1 decade ago
Because when ever the break statement given in loop.
The loop terminates and control get out from the loop.
The loop terminates and control get out from the loop.
Neha Singla said:
1 decade ago
The value of x is nt declared before the for loop, so it will not enter the loop and program will exit....
Bhavin Patel said:
1 decade ago
If condition of the for loop becomes false then loop will be terminated. So, INDIABIX will print 0 times.
Kalaivani said:
1 decade ago
Else statement should not be followed by break;.
If break is used in else statement it returns nothing.
If break is used in else statement it returns nothing.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers