Challenge "Paint Costs" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Challenge "Paint Costs"

Hi, I've tried this little challenge but i cant seem to understand why only 3 of the 5 cases are correct. and the challenge doesn't tell me why it fails Here's my code #include <iostream> using namespace std; int paint(int x) { cout << x; } int main() { int x, total, tax; cin >> x; total = x*5+40; tax = total + (total / 10); paint(tax); //paint each = 5 //materials = 40 //tax = 10% }

21st Jan 2024, 4:57 PM
Reda Abdoun Ribeiro
Reda Abdoun Ribeiro - avatar
4 Answers
+ 3
The problem in your code is that the output must be rounded to the nearest number, here is how to do it: https://sololearn.com/compiler-playground/cQjl7Ftt7RF9/?ref=app
21st Jan 2024, 5:24 PM
NinjaGamer
NinjaGamer - avatar
+ 2
Hello! It wouldn't be very helpful if you added the link to the code, not the code in the question. This is your code: https://sololearn.com/compiler-playground/cr7X2GZcEa54/?ref=app
21st Jan 2024, 5:16 PM
NinjaGamer
NinjaGamer - avatar
+ 1
Thanks for the help
21st Jan 2024, 5:28 PM
Reda Abdoun Ribeiro
Reda Abdoun Ribeiro - avatar
+ 1
Reda Abdoun Ribeiro I shouldn't thank you, it's ours work 😉
21st Jan 2024, 5:34 PM
NinjaGamer
NinjaGamer - avatar