0

You are working on a ticketing system. A ticket costs $10. The office is running a discount campaign: each group of 5 people i

I wrote the code but didn't run Help someone include <iostream> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } int n = sizeof(ages)/ sizeof(ages[0]); int minimum = ages[0]; for( int i =0 ; i < 5; i++) { minimum = min(minimum , ages[i]); } double d = 50(minimum/100.00); double total = 50-d; cout<<total; return 0 ; }

8th Aug 2021, 11:29 AM
Deepak Singh
Deepak Singh - avatar
7 Respostas
+ 1
Sagar Kumar You didn't. Check this 50 - 50 (minimum/100.0) in your code which is wrong. You are missing *
8th Aug 2021, 11:57 AM
A͢J
A͢J - avatar
+ 1
I solved it once.
10th Aug 2021, 5:58 AM
Md Abu Taher
Md Abu Taher - avatar
0
Sagar Kumar You are wrongly getting minimum value. There should be ages[i] minimum = min(minimum , ages[i]); And also you have closed extra bracket before getting total. Close bracket after return statement ------------ #include <iostream> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } int n = sizeof(ages) / sizeof(ages[0]); int minimum = ages[0]; for( int i = 0 ; i < 5; i++) { minimum = min(minimum, ages[i]); } double total = 50 - 50 * (minimum / 100.00); cout << total; return 0 ; }
8th Aug 2021, 11:45 AM
A͢J
A͢J - avatar
0
Sagar Kumar Just copy my code then tell me.
8th Aug 2021, 11:53 AM
A͢J
A͢J - avatar
0
Thanks bro Run that code by the help of yours 🙏
8th Aug 2021, 12:28 PM
Deepak Singh
Deepak Singh - avatar
9th Aug 2021, 4:04 AM
Mohamed
Mohamed - avatar
0
#include <iostream> #include <string> #include <climits> using namespace std; int main() { int ages[5]; double min = INT_MAX; double total; double discount; for (int i = 0; i < 5; i++) { cin >> ages[i]; if (ages[i] < min) min = ages[i]; } total = 50 * (min/100); discount = 50 - total; cout << discount; cout << endl; return 0; }
25th Aug 2022, 7:32 AM
the Monu
the Monu - avatar