in Programming in C edited by
9,849 views
5 votes
5 votes

What is the output of tho following program?

main(){
    int x=2, y=5;
    if(x<y) return (x=x+y);
            else printf("z1");
    printf("z2");
}
  1. $z2$
  2. $z1z2$
  3. Compilation error
  4. None of these
in Programming in C edited by
by
9.8k views

4 Comments

option D is correct.
0
0
yes the answer is correct. option D.
2
2
why “ printf("z2");” is not executed?
1
1
Returning int without specifying return type is a compiler error since c99.

https://stackoverflow.com/questions/30542092/function-without-return-type-specified-in-c
0
0

6 Answers

1 vote
1 vote
No output if condition is true and value x is returned
0 votes
0 votes

ANSWER: D NONE OF THESE

plz run this:

#include<stdio.h>
int main()
{
   int x=2,y=5;
   if(x<y)
   {
      return (x=x+y);
   }
   else
   {
      printf("z1");
   }
   printf("z2");
}

Answer:

Related questions