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; }
2 ответов
+ 3
Your code fails when both "points" and "cost" are equal to zero.
+ 1
Thank you very much!