0

What am i doing wrong? It wont output decimals

#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 b; int g; int s = 0; double Percent; double Discount; double Savings; do{ int a = ages[s]; b = ages[0]; if(b >= a){ g = ages[s]; } s++; }while(s < 5); Percent = g / 100; Savings = Discount - 50; cout << Percent; return 0; }

14th Nov 2022, 9:21 PM
Taegen Walton
Taegen Walton - avatar
1 Réponse
+ 3
int min = ages[0]; for (int i = 0; i < 5; ++i) { if (ages[i]<min) min = ages[i]; } double sum = 50-(min/2.0); cout << sum;
14th Nov 2022, 9:57 PM
SoloProg
SoloProg - avatar