Conditional Operator:-
Conditional Operator is a decision-making structure . it can be used in place of simple if-else structure. it also called ternary Operator as it uses three operands
Example:-
#include<stdio.h>
int main()
{
int x,y;
printf("Enter two numbers:");
scanf("%d %d", &x,&y);
x > y ? printf("%d is larger",x):printf("%d is larger",y);
}
Output:-
Enter two numbers: 12 50
50 is larger
No comments:
Post a Comment
Thanks for comment