Largest of two numbers using conditional operator

Introduction:
Write a C Program to find the largest of two numbers using the conditional operator in C Language.
The program should accept two numbers and find the largest. The program should use only the C Language conditional operator.
Examples:
Input:
Output:
Syntax Conditional Operator in C:
Condition ? TrueExpression : FalseExpression
If the Condition is True then the TrueExpression will be executed.
Similarly, If the Condition is false, Then FalseExpression will be executed.
We can have nested conditional Operators in C Langauge.
We have discussed the conditional operators in detail in the following post – C Language: Conditional Operator (? Tutorial | Ternary Operator/ Conditional operator tutorial with Examples – SillyCodes
3 Responses
[…] have looked at the Program to find the Maximum of two numbers using the if else statement and conditional statements. In today’s article, We are going to write a C Program to find the maximum of two numbers […]
[…] C Program to Calculate Largest of two numbers using conditional operator […]
[…] C Program to Calculate Largest of two numbers using conditional operator […]