C Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - Find Output of Program (Q.No. 11)
11.
What will be the output of the program?
#include<stdio.h>
int main()
{
    int k, num = 30;
    k = (num < 10) ? 100 : 200;
    printf("%d\n", num);
    return 0;
}
200
30
100
500
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
39 comments Page 4 of 4.

VANI said:   1 decade ago
Please explain this logic.

(num < 10) ? 100 : 200;.

Manal said:   1 decade ago
I don't understand the k=(num< 100) 100:200

Radhanath said:   1 decade ago
Absolutely to print the value of num=30.

Venkat said:   1 decade ago
Yeah you're exactly correct sudhakar.

Prathamesh said:   8 years ago
Thanks for all the given explanation.

Kummi said:   6 months ago
Yes, 30 is right. I too agree.

Yoga said:   9 years ago
Please explain me the answer.

Veerappa sudhakaran said:   1 decade ago
Exactly num value = 30.

Anoo said:   1 decade ago
@sudhakar thank you.


Post your comments here:

Your comments will be displayed after verification.