0

My code is showing error for test case 5. My attempt in comment section.

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

3rd Jan 2021, 2:20 PM
Mahak
4 Antworten
+ 8
//Mahak Add this int d = round(p); cout<<d;
3rd Jan 2021, 2:51 PM
Simba
Simba - avatar
+ 2
#include <iostream> #include <cmath> using namespace std; int main() { float n; cin>>n; float c = n*5.00 ; float p = c + 0.1*(c + 40.00) + 40.00; cout<<round(p); return 0; } thanks for reminding Simba
3rd Jan 2021, 4:03 PM
Mahak
+ 2
Thank you Lisa Simba It's done.
3rd Jan 2021, 4:31 PM
Mahak
+ 1
Is you output after rounding up still a float? According to the task description an integer is required...
3rd Jan 2021, 4:13 PM
Lisa
Lisa - avatar