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

Popular posts from this blog

C program to copy the contents of one file to another

Division of two complex numbers

Student marks by using structures