6. Conditional
Operators
Conditional Operator is ? :.Before the
question mark we write the condition. After the question mark it show the
result if the condition is true else if the condition is fail it executes after
the colon result.
Syntax 1:-
(<Condition>)?<truevalue>:<falsevalue>;
Conditional operator gives the result
if the condition is true or false.
output
Syntax 2:-
(<Condition1>)?<truevalue>:(<Condition2>)?<truevalue>:<falsevalue>;
Write a program to check whether the given number is positive or negative or zero.
output
Syntax 3:- variable=(<Condition>)?<truevalue>:<falsevalue>;
Write a program to findout the biggest number
among the given number.













No comments:
Post a Comment