+ 4

Hovercraft challenge

Test 1 fails #include <iostream> #include <string> using namespace std; int a; //input how many int b; //monthly made int c; //price they pay int sumOut; //price you pay int sumIn; //how much you make int main() { int a; cin >> a; //10 a month at 2000000= 20000000 // insurance 1000000 b = 19000000; c = 3000000; sumIn = (a * c); if(b == sumIn){ cout << "Broke Even" << endl; } else if (b > sumIn){ cout << "Loss" << endl; }else{ cout << "Profit" << endl; } return 0; }

20th Jan 2022, 8:20 PM
Montell Ifill
3 Respostas
+ 5
Your monthly costs: 10 x 2.000.000 + 1.000.000 cost = 21.000.000 Your income: income = a x 300.000 income < cost => Loss income = cost => Broke Even income > cost => Profit
20th Jan 2022, 9:17 PM
Coding Cat
Coding Cat - avatar
+ 5
Montell Ifill There should be plus instead of minus So b = 21000000
20th Jan 2022, 9:20 PM
A͢J
A͢J - avatar
+ 3
Thanks yeah that fixed it
20th Jan 2022, 9:20 PM
Montell Ifill