+ 2
Write a program in C to find maximum and minimum of three inputs without using if statement
4 Antworten
+ 14
use array & find max,min of n numbers without any if else
+ 9
My try in C
https://code.sololearn.com/cLY3mVNP0i55/?ref=app
+ 3
Here it is in C and for three values.
#include <stdio.h>
int main() {
int a, b, c;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
int max = (a >= b && a >= c) ? a : (b >= a && b >= c) ? b : c;
int min = (a <= b && a <= c) ? a : (b <= a && b <= c) ? b : c;
printf("max is %d, min is %d", max, min);
return 0;
}
+ 1
S...We can use it @Marcel Feenstra