+ 1
What is wrong with my code ? The min gets me the maxiimum number in the array??
#include <iostream> using namespace std; int main() { int ages[5]; int min; int sum; int ans; for (int i = 0; i < 5; i++) { cin >> ages[i]; } for (int j = 0; j < 5; j++) { sum = sum + ages[j]; } for (int k = 0; k < 4; k++) { if(ages[k] < ages[k++]){ min = ages[k]; } else{ min = ages[k++]; } } ans = (sum*(min/100)); cout << min << endl; cout << sum << endl; cout << ans << endl; return 0; }
4 odpowiedzi
0
I deleted the other duplicate :) Thank you for telling me. would you please upvote my question so it would reach someone who would be nice enough to answer me :)
0
I am so sorry Martin Taylor