+ 3

how to find smallest and largest number in C not C++

Write a program that reads in five integers and then determines and prints the largest and the smallest integers in the group.

26th Mar 2018, 4:21 PM
Jordan
Jordan  - avatar
8 Respuestas
+ 11
you can try to put entered numbers in array and try then to find min and max of array
26th Mar 2018, 4:32 PM
Vukan
Vukan - avatar
+ 4
#include<stdio.h> int main() { int a, b; printf("Enter two numbers"); scanf("%d %d", &a, &b); if(a>b) printf("a is max"); else printf("b is max"); return 0; }
26th Mar 2018, 4:24 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 3
let me create a code
26th Mar 2018, 4:29 PM
Raj Chhatrala
Raj Chhatrala - avatar
26th Mar 2018, 4:42 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
and what about 5 integers..
26th Mar 2018, 4:28 PM
Jordan
Jordan  - avatar
+ 2
this is the solution
26th Mar 2018, 4:42 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
you could sort them and take the two ends
26th Mar 2018, 5:00 PM
Rational Agent