+ 2

[solved] Why not working??

You are working on a ticketing system. A ticket costs $10. The office is running a discount campaign: each group of 5 people is getting a discount, which is determined by the age of the youngest person in the group. You need to create a program that takes the ages of all 5 people as input and outputs the total price of the tickets. Sample Input: 55 28 15 38 63 Sample Output: 42.5 The youngest age is 15, so the group gets a 15% discount from the total price, which is $50 - 15% = $42.5 Code: #include <iostream> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //your code goes here int y= ages[0]; for(int x=0;x<5;++x) { if (y>ages[x]); { y=ages[x]; } } float disc=0,total=50; disc = total-((total /100)*y); cout<<disc; return 0; }

31st Dec 2020, 4:32 PM
Sehar Kanwal
Sehar Kanwal - avatar
12 Antworten
- 2
if ( y > ages[x] ) // <- remove semicolon
31st Dec 2020, 4:48 PM
Ipang
+ 4
Ipang thank you
31st Dec 2020, 4:55 PM
Sehar Kanwal
Sehar Kanwal - avatar
+ 2
No problem 👌
31st Dec 2020, 4:57 PM
Ipang
+ 2
🤗🤗🤗🤗
31st Dec 2020, 4:58 PM
Sehar Kanwal
Sehar Kanwal - avatar
+ 1
Write [Solved] in your question when it's solved.
2nd Jan 2021, 10:53 AM
Lakshay
Lakshay - avatar
+ 1
Sehar Kanwal bcuz it helps other to understand that the query is solved .
2nd Jan 2021, 12:04 PM
Lakshay
Lakshay - avatar
+ 1
ty
20th Apr 2021, 2:08 AM
alvion looper
alvion looper - avatar
+ 1
#include <iostream> using namespace std; int main() { int ages[5],x=ages[0]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; if(x>ages[i]){ x=ages[i]; } } cout<<50-((x/100)*50); return 0; }
28th May 2021, 5:55 PM
youssef
youssef - avatar
+ 1
Solución al proyecto número 3 del curso de C++ #include<iostream> using namespace std; int main(){ float edad[5],menor=99999; float descuento; for(int i=0;i<5;i++){ cin>>edad[i]; if(edad[i] < menor){ menor = edad[i]; } } descuento = 50-(menor*50/100); cout<<descuento<<endl; return 0; } //espero haberles ayudado :)
1st Jun 2021, 11:56 PM
Yerssin Pérez
Yerssin Pérez - avatar
0
Lakshay Why??
2nd Jan 2021, 11:22 AM
Sehar Kanwal
Sehar Kanwal - avatar
0
Okay ...done 🙃🙃
2nd Jan 2021, 12:45 PM
Sehar Kanwal
Sehar Kanwal - avatar
2nd Jun 2021, 5:09 AM
Sehar Kanwal
Sehar Kanwal - avatar