what is the output in if-else statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spratik
    New Member
    • Jan 2016
    • 1

    what is the output in if-else statement

    int x=3,y,z;
    y=x=10;
    z=x<10;
    printf("x=%d y=%d z=%d,x,y,z");
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    I don't see any if-else in here.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      There are a couple of things wrong with your printf statement. Change it to...
      Code:
      printf("x=%d y=%d z=%d\n",x,y,z);
      I moved the close-quote to the left so that x,y,z is outside the quoted string.
      I terminated the format string with a newline. This insures the output appears even if that port has buffered output.

      What do you get when you run the program?

      Comment

      Working...