How to use <= operator without if in C

2 Answers

0 votes
#include <stdio.h>

int main(void) {
    int x = 2, y = 35;  
  
    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 = 2, y = 35;  
   
    printf("%s", x <= y ? "yes" : "no");
     
    return 0; 
}
 
 
 
 
/*
run:
  
yes
  
*/

 



answered Nov 2, 2021 by avibootz

Related questions

2 answers 252 views
252 views asked Nov 1, 2021 by avibootz
2 answers 253 views
253 views asked Nov 1, 2021 by avibootz
2 answers 262 views
262 views asked Nov 1, 2021 by avibootz
2 answers 274 views
1 answer 219 views
1 answer 319 views
1 answer 260 views
...