ExamVeda
Login
Home
This question belongs to C Program Control Structures
Control Structures
?

Find the output of the following program.
#include<stdio.h>
void main()
{
   int y=10;
   if(y++>9 && y++!=10 && y++>11)
      printf("%d", y);
   else
      printf("%d", y);
}

Answer & Solution
Correct Answer: Option C
Here if Statement is true and if statement executes left to right. Since its AND operator so all the condition should be check until it finds any false statement. Initially y = 10 In 1st condition: y++>9 which is true and y become 11 in next use. In 2nd condition: y++!=10 which is also true and y become 12 in next use In 3rd condition: y++>11 which is also true and y become 13 in next use After that printf statement will execute and print y = 13
Examveda
Question posted by Examveda
Community

Join the Discussion

6 Comments
Nabin Bhandari
Nabin Bhandari 3 years ago
WHAT IS THIS PROGRAMS OUTPUT
CLS
W$="PATTERN"
FOR I=1 TO 7 STEP 1
PRINT LEFT$(W$,I)
NEXT I;
END
Siva Sangari
Siva Sangari 3 years ago
#include
#include
main()
{
float a,s,sq;
printf ("/n enter the number");
scanf ("%f", &a);
s=a8a;
sq=srrt(a);
printf ('/n square= %f," s);
printf ("/n square root =%f," sq);
}
Zelko Zeed
Zelko Zeed 4 years ago



What is program output
#include
void main 0 {
int i = -1, j = -1, k = 0, I = 2, m;
m = i++ &&j++ &&k++ ll 1++;
printf (" Vo dLo d%o dvo dLo d",i j,k,l,m) ;
l
Ujwal Channel
Ujwal Channel 4 years ago
Cls
Input "Enter any 3 numbers ";N
IF SGN (N)=1. THEN
PRINT N; "is the odd number"
ELSE
PRINT N; "is null or zero number"
ELSE IF
END
Anoop Sivakumar
Anoop Sivakumar 8 years ago
how?
Ro Ma
Ro Ma 9 years ago
how