Write a C program to input three numbers from user and find maximum between three numbers using conditional/ternary operator ?:
. How to find maximum between three numbers using conditional operator.
Example
Input
Input num1: 10 Input num2: 20 Input num3: 30
Output
Maximum is 30
Required knowledge
Basic C programming, Conditional operator, Logical operators
Learn how to write the same program using if...else
statement.
Learn more – Program to find maximum between three numbers using if…else
Program to find maximum between three numbers
Important note: In the above conditional operator I have used proper separators (spaces and new lines) to add readability to code. Practice a good habit to add more and more separators in your code to make it clear.
Output
Enter three numbers: 10 20 30 Maximum between 10, 20 and 30 = 30
Happy coding