0

[solved] Skee-Ball problem: 1/5 cases failed

Hi guys, can't figure out why the code doesn't work: #include <iostream> using namespace std; int main() { int points, cost; cin >> points >> cost; double tickets = points / 12.0; double x = tickets / cost; if(x >= 1.0){ cout << "Buy it!"; } else { cout << "Try again"; } return 0; }

19th Oct 2020, 2:45 PM
Galina
Galina - avatar
2 Answers
+ 3
Your code fails when both "points" and "cost" are equal to zero.
19th Oct 2020, 2:55 PM
Arsenic
Arsenic - avatar
+ 1
Thank you very much!
19th Oct 2020, 5:49 PM
Galina
Galina - avatar