Write a C program to find the maximum number from 3 numbers.
#include<stdio.h>
#include<conio.h>
int main();
{ int a,b,c;
clrscr();
printf(“Enter value of A:”);
scanf(“%d”,&a);
printf(“Enter value of B:”);
scanf(“%d”,&b);
printf(“Enter value of C:”);
scanf(“%d”,&c);
((a>b)&&(a>c))?printf(“%d is maximum”,a):((b>c)&&(b>a))?printf(“%d is maximum”,b):printf(“%d is maximum”);
return 0;
}
Here the conditional statement is used.The syntax of the conditional statement is:
(condition)?(True statement):(New condition or False statement)
Output