C Programming - Control Instructions - Discussion
Discussion Forum : Control Instructions - Point Out Correct Statements (Q.No. 6)
6.
Which of the following statements are correct about the below C-program?
#include<stdio.h>
int main()
{
int x = 10, y = 100%90, i;
for(i=1; i<10; i++)
if(x != y);
printf("x = %d y = %d\n", x, y);
return 0;
}
1 : | The printf() function is called 10 times. |
2 : | The program will produce the output x = 10 y = 10 |
3 : | The ; after the if(x!=y) will NOT produce an error. |
4 : | The program will not produce output. |
Discussion:
70 comments Page 6 of 7.
Dhronan said:
1 decade ago
@ imran and pal:.
There is no problem on executing that statement, because it is terminated at every iteration of for loop. The condition inside the if statement produces 0, but that wouldn't affect the program. Because ";" terminates at every iteration.
There is no problem on executing that statement, because it is terminated at every iteration of for loop. The condition inside the if statement produces 0, but that wouldn't affect the program. Because ";" terminates at every iteration.
Pall said:
1 decade ago
X=10, y=10 , then how if(x != y) statement will execute ?pls some 1 answer asap
Imran said:
1 decade ago
X=10, y=10 , then how if(x != y) statement will execute ?
Kans said:
1 decade ago
@Gopi
It means only the ramainder alone will be taken into account.
It means only the ramainder alone will be taken into account.
Gopinath.nan said:
1 decade ago
What is the meaning of y=100%90 ?
Ravi said:
1 decade ago
Good explanation sai thanx a lot.
Syed said:
1 decade ago
Nice explanation given by Kavya
Thanks....
Thanks....
Munni said:
1 decade ago
Nice explanation kavya.
Nitika said:
1 decade ago
Hmmm. Right kavya.
Karthik said:
1 decade ago
Good explanation kavya.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers