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

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.