C program to find largest among 3 numbers using conditional operator.
#include<stdio.h>
int main( )
{
int num1, num2, num3, large, temp;
printf("Enter the number");
scanf("%d %d %d",&num1,&num2,&num3);
temp=(num2>num3)?num2:num3;
large=(num1>temp)?num1:temp;
printf("Largest among 3 is %d ", large);
return 0;
}
0 Comments