Output of C programs | Set 65 (If-Else)

Prerequisite : Decision making in C

Question 1

a)Segmenation fault
b)Compilation error
c)Print 1 Infinite time
d)Both a & c

OUTPUT:  (d)Both a & c

We call the main method again and again by 1 because we use post-increment. At certain time stack frame will full means segmentation fault occurs.

Question 2

a)mannu is Crazy
b)paul is crazy

OUTPUT:  (b)paul is crazy 

Here ,comparision between long int and unsigned long int generally which is not possible.
Now,long int is promoted to unsigned long int whose value will be

Question 3

a)Hello 3
b)Hello 0
c)Geeksforgeeks 0
d)Geeksforgeeks 3

OUTPUT:  (d) Geeksforgeeks 0

Explanation: Atfirst zero will assign in ‘i’ then comma operator returns the last value which is 3 and condition becomes true.

Question 4

a)Hello 3
b)Geeksforgeeks 0
c)Hello 0
d)Geeksforgeeks 3

OUTPUT:  (c) Hello 0

Explanation: Priority of parenthesis bracket is greater than equal to(=) operator , So atfirst comma operator return the last value which is zero(0) and then equal to(=) operator assign 0 to ‘i’ and condition becomes flase.

Question 5

a)Compilation error


a = 0.7 is rounded to 0.699999988
and the constant 0.7 is as 0.69999999999
so a<0.7 is true so it print "c"
but in case of 0.8
a = 0.800000011 and
constant 0.8 is 0.8000000000000000

This article is contributed by Abhishek kurmi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

My Personal Notes arrow_drop_up

Recommended Posts:

    Article Tags :

    Be the First to upvote.

    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.