C program to compare 2 numbers using ternary operator

Problem Statement

Write a program in C to compare 2 numbers without using if statement but instead use the ternary operator.

C program to compare 2 numbers using ternary operator

#include <stdio.h> 
int main() 
{ 
        int x=8, y=4 ; 
        y = ( x>y ? printf("x is greater") : printf("y is greater") ) ; 
}