Sunday, 4 September 2016

write a program in c accept four numbers find out the minimum value using ternary operator..

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,m,n;
printf("\n enter 4 numbers");
scanf("%d%d%d%d",&a,&b,&c,&d);
(m=(a<b?a:b))<(n=(c<d?c:d))?printf("minimum number is=%d",m):printf("minimum number=%d",n);
}

 if u want explanation of this code then see solution pic of this question..if u have any doubt and then then plzz write comment ...i hope u like it      thanku

2 comments: