Consider the following Conditional statement:if(a>b)
x=a;
else
x=b;
Write the equivalent code segment using a ternary
operator pair "?:"
Ans:- a>b?x=a:x=b;
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,x;
a>b?x=a:x=b;
if(a>b)
{
x=a;
}
else
{
x=b;
}
getch();
}