C Program to Find Maximum b/w Three Numbers Using Conditional Operators ?
Q:- Write a C Program to Find Maximum Between Two Numbers Using Conditional
Operators ?
Operators ?
Input
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int num1,num2,num3,max;
clrscr();
printf("Enter Three numbers =");
scanf("%d%d%d",&num1,&num2,%num3);
scanf("%d%d%d",&num1,&num2,%num3);
max = (num1>num2 && num1>num3) ? num1:
(num2>num3) ? num2 : num3;
(num2>num3) ? num2 : num3;
printf("Maximum b/w %d ,%d and %d=%d",num1,num2,num3,max);
getch();
}
Output
Enter Three Numbers =
10
20
30
Maximum b/w 10 ,20 and 30 = 30
10
20
30
Maximum b/w 10 ,20 and 30 = 30
Comments
Post a Comment