by Dinesh Thakur

In this program user ask to define the ternary operator. User declares some required variables that contain values in it. Ternary operator denote by ?: this can be used as a shortcut for an if-else statement. Here user declare a condition to evaluate the method user ask to enter the value. b= (a>5?1:0); and display result on the screen as output.

Problem Statement:
This is C program that ask user to define the ternary operator.

  1. Declare the variables.
  2. Using method to evaluate the condition.
  3. Display result on the screen.

Here is C source code for using ternary operator. The output of this program shown below. 

void main()
int a,b;
printf("enter any value ");

Evaluation with Ternary Operation