Maxium And Minimum of Three Numbers Using Terinary Operator
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c,large,small;
printf("Enter a,b,c Values:");
scanf("%d%d%d",&a,&b,&c);
small=(a<b&&a<c)?a:(b<c)?b:c;
large=(a>b&&a>c)?a:(b>c)?b:c;
printf("Largest Of Three Numbers is %d \n",large);
printf("Smallest Of Three Numbers is %d",small);
return 0;
getch();
}
Comments
Post a Comment