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 5 of 7.
Kiranmai said:
9 years ago
@Kavya.
Your explanation is clear and useful. Thank you.
Your explanation is clear and useful. Thank you.
(1)
Imran said:
1 decade ago
X=10, y=10 , then how if(x != y) statement will execute ?
Deepanshu said:
1 decade ago
If statement cannot be terminated by semi-colon.
Syed said:
1 decade ago
Nice explanation given by Kavya
Thanks....
Thanks....
Sandeep said:
1 decade ago
Please show me X and Y value correct answer.
Sandeep said:
1 decade ago
X=10, Y=10 for loop statement no inside.
Sanjay said:
8 years ago
Thank you, for explaining this program.
(2)
Abhay said:
1 decade ago
Thank for best guidance and explanation
Sri said:
1 decade ago
Thanks Kavya. Very good explanation.
Abbas haider said:
1 decade ago
Can we put ';' after for loop also?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers