Sunday, 26 February 2017

IO 8

QUESTION DESCRIPTION :


Write a program to find the largest of three numbers using ternary operator

Input and Output Format:

Refer sample input and output for formatting specification.

All float values are displayed correct to 2 decimal places.

All text in bold corresponds to input and the rest corresponds to output.


TEST CASE 1


INPUT

4 5 6

OUTPUT

The biggest number is:6


TEST CASE 2


INPUT

99 9999 99999

OUTPUT

The biggest number is:99999


EXPLANATION : 

The code requires you to print the largest among the 3 numbers but you need to use the ternary operator ( Ternary Operation )

ALGORITHM : 

  • Accept the numbers from the user ( a,b,c )
  • Check the largest number using ternary operator
  • Print the largest number with the appropriate message

SOLUTION : (Please use this as reference only)

CODE


No comments:

Post a Comment