Program to show the use of conditional operator.

Program to show the use of conditional operator.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf(“enter value for a & b: ”);
scanf(“%d%d”,&a,&b);
(a>b)?printf(“a is greater”):printf(“b is greater”);
getch();
}
Output:
enter value for a & b: 5
7
b is greater

No comments:

Post a Comment