+ 1

Paint Cost code coach

Paint costs +10 XP You are getting ready to paint a piece of art. The canvas and brushes that you want to use will cost 40.00. Each color of paint that you buy is an additional 5.00. Determine how much money you will need based on the number of colors that you want to buy if tax at this store is 10%. Task Given the total number of colors of paint that you need, calculate and output the total cost of your project rounded up to the nearest whole number. Input Format An integer that represents the number of colors that you want to purchase for your project. Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. Sample Input 10 Sample Output 99 I tried solving this challenge but ended up passing just 4 out of the five testcases This is the code in python i = int(input()) print(int(round(40+i*5+(40 + i *5)*0.1, 0)))

16th Jan 2020, 1:36 PM
Joshua Evuetapha
Joshua Evuetapha - avatar
5 ответов
+ 8
The task description says that the total cost has to be rounded up. As you use round(), this does not give always the expected value. You should use math. ceil() function instead. You have to import math in advance.
16th Jan 2020, 3:59 PM
Lothar
Lothar - avatar
+ 3
Thanks this helped me
16th Jan 2020, 2:20 PM
Joshua Evuetapha
Joshua Evuetapha - avatar
+ 3
color = int(input()) prise = round((40 + 5 * color)*1.1) print (prise)
26th Apr 2020, 1:57 PM
Мансур Валиев
Мансур Валиев - avatar
+ 2
FOR C PROGRAMMING #include<stdio.h> #include<math.h> int main() { float paint; scanf("%f",&paint); float cost = 40+(paint*5); float tax = cost/10; float total=cost+tax; printf("%.0f",ceil(total)); return 0; }
17th Jan 2021, 7:00 AM
SRI SIVA LAKSHMANA REDDY DWARAMPUDI
SRI SIVA LAKSHMANA REDDY DWARAMPUDI - avatar