How to compare two numbers without using if else in C

1 Answer

0 votes
#include <stdio.h>

int main(void) {
    int a = 7, b = 12;

    a > b ? printf("a > b") : printf("b >= a");

    return 0;
}




/*
run:

b >= a

*/

 



answered May 19, 2022 by avibootz

Related questions

1 answer 2,810 views
6 answers 674 views
2 answers 232 views
1 answer 113 views
2 answers 291 views
...