Answers for "c program to find minimum of 4 numbers using conditional operator in c"

C
0

c program to find minimum of 4 numbers using conditional operator in c

//C program to find Smallest among four numbers using Conditional or ternary operator

#include<stdio.h>

void main()
{
  // Variable declaration
   int a,b,c,d,small;

   printf("Enter four numbern");
   scanf("%d %d %d %d",&a,&b, &c, &d);

 // Smallest among a, b, c and d2
   small = ( (a<b && a<c && a<d) ? a : (b<c && b<d) ? b : (c<d)? c : d );

 //Display Smallest number
   printf("Smallest Number is : %d",small);

}
Posted by: Guest on January-02-2022

Code answers related to "c program to find minimum of 4 numbers using conditional operator in c"

Code answers related to "C"

Browse Popular Code Answers by Language