Saturday, August 18, 2018

IO-8

  • Problem 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
  • CODING ARENA::
  • #include <stdio.h>
    int main()
    {
      int a,b,c;
      scanf("%d%d%d",&a,&b,&c);
      if(a>c)
      {
        if(a>b)
        {
          printf("The biggest number is=%d",a);
        }
        else{
          printf("The biggest number is=%d",b);
        }}
      else{
        printf("The biggest number is=%d",c);
      }
      

    return 0;
    }
  • Test Case 1

    Input (stdin)
    4 5 6
    
    
    Expected Output
    The biggest number is=6
  • Test Case 2

    Input (stdin)
    25 23 24
    
    
    Expected Output
    The biggest number is=25

No comments:

Post a Comment