google407ec42f1ae5ff0e.html
top of page

write a c program using ternary operator


#include<stdio.h>

void main()

{

int a,b,max;

printf("Enter values for a and b :");

scanf("%d%d",&a,&b);

max = a>b ? a : b; /*ternary operator*/

printf("Larger of %d and %d is %d\n",a,b,max);

getch();

}

5 views0 comments

Recent Posts

See All
bottom of page