Write a program which take three values and print Max. Value (using ternary operator) in C.

#include<stdio.h>
#include<conio.h>
void main()
{
  int n1,n2,n3,m,m1;
  printf("Enter the Number 1st = ");
  scanf("%d",&n1);
  printf("Enter the Number 2nd = ");
  scanf("%d",&n2);
  printf("Enter the Number 3rd = ");
  scanf("%d",&n3);
  m=n1>n2?n1:n2;
  m1=m>n3?m:n3;
  printf("Largest Number is  = %d",m1);
getch();
}
 

OUTPUT : - 

Previous Post
Next Post