Program to find greatest number between 2 numbers using ternary operator in c language.
#include<stdio.h>
#include<conio.h>
void main()
{
int ans,a,b;
clrscr();
printf("enter two numbers=");
scanf("%d%d",&a,&b);
ans=a>b?a:b;
printf("answer is =%d",ans);
getch();
}
Output-
Comments
Post a Comment