Discussion Forums

New User? Please read instructions!

C program to compare 2 numbers without if statement  

  RSS

thiyagarajan.s
Active Member
Joined:10 months  ago
Posts: 14
27/01/2017 10:02 am  

C program to compare 2 numbers without if statement


ReplyQuote
admin
Eminent Member Admin
Joined:5 years  ago
Posts: 26
10/02/2017 10:26 am  

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


ReplyQuote
  
Working

Please Login or Register






Share this website !!!
Facebook Twitter Linkedin