C Program To Find Minimum Of 4 Numbers Using Conditional

[Solved] C Program To Find Minimum Of 4 Numbers Using Conditional | Perl - Code Explorer | yomemimo.com
Question : c program to find minimum of 4 numbers using conditional operator in c

Answered by : akarsh-bajpai

//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 number\n"); 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);
}

Source : https://cstutorialpoint.com/c-program-to-find-smallest-number-using-conditional-operator/ | Last Update : Sun, 09 Jan 22

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

Answered by : akarsh-bajpai

//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 number\n"); 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);
}

Source : https://cstutorialpoint.com/c-program-to-find-smallest-number-using-conditional-operator/ | Last Update : Sun, 09 Jan 22

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

Code Explorer Popular Question For Perl