0

What's wrong with my code....

What's wrong with my code. As per the discount problem ,I coded the program . After all the test ,My output and the *expected* output are same.. but still displaying it's wrong . I couldn't understand where was I wrong. Kindly please sort out the issue in this.. so that I can understand and complete my project... https://code.sololearn.com/c04Mb34RNE7c/?ref=app

29th Dec 2021, 9:12 AM
Insecure Rush
Insecure Rush - avatar
2 Answers
+ 1
You have to output only the discount without any extra text or anything. And... Well, you can solve it using single for loop instead of all these else-if statements. Just like that: int low = ages[0]; for (int i =1; i < 5; i++){ if(low > ages[i]) low = ages[i]; } You can find the lowest age in the array
29th Dec 2021, 9:36 AM
Michal Doruch
0
Passed my three test.. but 4&5 return wrong...
29th Dec 2021, 10:35 AM
Insecure Rush
Insecure Rush - avatar