maximum of three numbers using conditional operators

#include<stdio.h>
int main() {
    int a,b,c,max;
    scanf("%d%d%d",&a,&b,&c);
    max = a > b ? (a > c ? a : c) : (b > c ? b : c) ;
    printf("maximum is %d",max);
 
return 0; 
}

No comments:

Post a Comment