Can somebody help me to solve this code about paint cost? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can somebody help me to solve this code about paint cost?

I dont know, why my code in case 3 and 4 is wrong. I have no idea. What missing code. https://code.sololearn.com/cYCs0kxC9IRr/?ref=app

15th Jan 2020, 7:54 AM
Guntur Darmawan
Guntur Darmawan - avatar
8 Answers
+ 2
Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. Edit: Also discount and pay should be float.
15th Jan 2020, 8:40 AM
Mihai Apostol
Mihai Apostol - avatar
+ 3
Thanks everyone :)
15th Jan 2020, 9:24 AM
Guntur Darmawan
Guntur Darmawan - avatar
+ 2
Fernando Pozzetti Also discount and pay should be float.
15th Jan 2020, 8:45 AM
Mihai Apostol
Mihai Apostol - avatar
+ 2
You're welcome.
15th Jan 2020, 9:28 AM
Mihai Apostol
Mihai Apostol - avatar
+ 1
Show us your code so we can help you. Remember to use Ceiling to apply tax if you are using division.
15th Jan 2020, 8:19 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 1
Change this line to: discount = ceil(count * 0.1); And add #include <cmath> Below the other include
15th Jan 2020, 8:43 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 1
Right. Remember that when we are using integers, the decimal numbers will be ignored, so we are losing precision in divisions.
15th Jan 2020, 8:50 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
H
16th Jan 2020, 12:24 PM
M Ikram