0

I can't complete level "Ticket office". Why is output 44 instead of 44.5. I wrote "float".

#include <iostream> using namespace std; int main() { int ages[5]; int min = ages[0]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; //ваш код while (ages[i] < min) { min = ages[i]; } } float a = 50*(100-min)/100; cout<<a; return 0; }

6th Feb 2021, 10:17 PM
Тимур Завьялов
Тимур Завьялов - avatar
2 Answers
+ 3
You need to type cast min to a float or double. float a = 50*(100-float(min))/100;
6th Feb 2021, 10:54 PM
♡Addy♡
♡Addy♡ - avatar
+ 2
// When you got the smallest age then easier will be to code: double a = 50; a -= a * min / 100.0;
6th Feb 2021, 11:47 PM
JaScript
JaScript - avatar