Code in c language:
#include <stdio.h>
int main()
{
int x=30;
if(x > 20)
{
printf("Variable x is greater than 20");
}
else
{
printf("Variable x is less than 20");
}
printf("\n\nCompare using Ternary Operator\n");
(x>20)?printf("Variable x is greater than 20"):printf("Variable x is less than 20");
return 0;
}
Output:
.
Get Answers For Free
Most questions answered within 1 hours.