Code output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marmar12
    New Member
    • Mar 2008
    • 11

    Code output

    int a = 17, b;
    59.
    60. b = a;
    61. printf ("b = %d\n", b);
    62.
    63. b = b + 1;
    64. printf ("b = %d\n", b);
    65.
    66. b = a / b;
    67. printf ("b = %d\n\n\n", b);


    given code, i think the output would be 0 given that
    1. a=b=17
    2. 17+1=18=b
    3. 17/18=0=b

    Is this right? i just want to check my answer.
    thanks.
  • mac11
    Contributor
    • Apr 2007
    • 256

    #2
    It looks right to me, but it would be way quicker for you to just drop the code snippet into a main() and compile/run it. That way you don't have to wait for somebody else to come along and read your post :-)

    Comment

    Working...