How to use > operator without if in C

2 Answers

0 votes
#include <stdio.h>

int main(void) {
    int x = 13, y = 7;  
  
    int temp = (x > y);  
  
    printf("%d\n", temp);  
    
    return 0; 
}




/*
run:
 
1
 
*/

 



answered Nov 1, 2021 by avibootz
0 votes
#include <stdio.h>
 
int main(void) {
    int x = 13, y = 7;  

    printf("%s", x > y ? "yes" : "no");
     
    return 0; 
}
 
 
 
 
/*
run:
  
yes
  
*/

 



answered Nov 2, 2021 by avibootz

Related questions

2 answers 259 views
259 views asked Nov 1, 2021 by avibootz
2 answers 247 views
247 views asked Nov 1, 2021 by avibootz
2 answers 247 views
247 views asked Nov 1, 2021 by avibootz
2 answers 270 views
1 answer 216 views
1 answer 317 views
1 answer 255 views
...