Discussion :: Expressions - Find Output of Program (Q.No.14)
|Sumit Rawal said: (Aug 28, 2011)|
|Its so confusing. Please expain it in more detail.|
|Pedro said: (Jan 22, 2014)|
|The actual answer is:
The letter isaNow the letter isA.
There is no space after "The letter is".
There is no \n.
There is no space again after "Now the letter is".
|Pradip said: (Dec 15, 2016)|
|How that A comes in the last line?Explain me.|
|Burak said: (Jan 25, 2017)|
|You are right @Pedro.
The right answer is: d) none of above.
There is no "\n" and " " in the code.
|Chandra said: (Jul 2, 2017)|
|'A' <= 'Z' ;is this true or false.
Please explain this.
I can't understand this.
|Ratan Dubey said: (Jul 8, 2017)|
|The exact o/p is:-
The letter isaNow the letter is A.
'A' <= 'Z' is true.
Here in this program, the compiler will proceed in ASCII values of the given letters 'A' and 'Z' has 65 and 91 ASCII value respectively so Simplifying it, as 65<=91 and that is true so the statement is true.
|Kamble said: (Aug 25, 2017)|
|The answer should be "none of above " since the new line character "\n " is given in 4th last printf () statement.|
|Mridul Sachan said: (Sep 12, 2017)|
|Answer should be None of the above.|
|Ajay007 said: (Jan 1, 2018)|
|The value of ch is not updated in second case.|
|Noel Nosse said: (May 4, 2018)|
|A conditional operator is a ternary operator, that is, it works on 3 operands.
Conditional Operator Syntax.
conditionalExpression? expression1 : expression2
The conditionaloperator works as follows:
The first expression conditional Expression is evaluated first. This expression evaluates to 1 if it's true and evaluates to 0 if it's false.
If conditional Expression is true, expression1 is evaluated.
If the conditional expression is false, expression2 is evaluated.
printf("If this year is leap year, enter 1. If not enter any integer: ");
// If test condition (February == 'l') is true, days equal to 29.
// If test condition (February =='l') is false, days equal to 28.
days = (February == '1') ? 29 : 28;
printf("Number of days in February = %d",days);
If this year is a leap year, enter 1. If not enter an integer: 1
Number of days in February = 29.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.