0
When I give input two smallest same numbers ....And how I make it shorter..
2 Respostas
0
Sid
This is not a proper way to write code. You will never get output.
Hint:-
Store 1st value in a variable and compare this value with next value in loop. If next value is less than 1st value then next value will be minimum value.
0
#include <iostream>
using namespace std;
int main() {
double y=0.5;
int age[5];
for (int i = 0; i < 5; ++i) {
cin >> age[i];
}
//your code goes here
if (age[0]<=age[1] && age[0]<=age[2] && age[0]<=age[3] && age[0]<=age[4]){cout<<50-y*age[0]<<endl;}
else {if (age[1]<=age[0] && age[1]<=age[2] && age[1]<=age[3] && age[1]<=age[4]){cout<<50-y*age[1]<<endl;}
else {if (age[2]<=age[1] && age[2]<=age[0] && age[2]<=age[3] && age[2]<=age[4]){cout<<50-y*age[2]<<endl;}
else {if (age[3]<=age[1] && age[3]<=age[2] && age[3]<=age[0] && age[3]<=age[4]){cout<<50-y*age[3]<<endl;}
else {if (age[4]<=age[1] && age[4]<=age[2] && age[4]<=age[3] && age[4]<=age[0]){cout<<50-y*age[4]<<endl;}}}}}
}