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

C
0

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

//C program to find Smallest among five numbers using ternary operator

#include<stdio.h>

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

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

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

 //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 5 numbers using conditional operator in c"

Code answers related to "C"

Browse Popular Code Answers by Language