Find maximum of three number in C without using conditional statement and ternary operator

前端 未结 13 2006
日久生厌
日久生厌 2020-11-29 22:25

I have to find maximum of three number provided by user but with some restrictions. Its not allowed to use any conditional statement. I tried using ternary operator like bel

13条回答
  •  醉酒成梦
    2020-11-29 23:12

    Try this.

    #include "stdio.h"
    main() {
        int a,b,c,rmvivek,arni,csc; 
        printf("enter the three numbers");
        scanf("%d%d%d",&a,&b,&c);
        printf("the biggest value is %d",(a>b&&a>c?a:b>c?b:c));
    }
    

提交回复
热议问题