How to use != inequality operator without if in C

2 Answers

0 votes
#include <stdio.h>

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

 



answered Nov 2, 2021 by avibootz

Related questions

1 answer 221 views
1 answer 173 views
2 answers 158 views
158 views asked Nov 1, 2021 by avibootz
2 answers 143 views
143 views asked Nov 1, 2021 by avibootz
2 answers 132 views
132 views asked Nov 1, 2021 by avibootz
2 answers 146 views
146 views asked Nov 1, 2021 by avibootz
...