x

C program to compare 2 numbers without if statement

C program to compare 2 numbers without if statement:

#include <stdio.h>


int main()

{

int x=15, y=4 ;


y = ( x>y ? printf(“x is greater than y”) : printf(“y is greater than x”) ) ;

}

 

Output:

x is greater than y



Like it? Please Spread the word!