+ 2

Can anyone solve the error.

#include <iostream> using namespace std; int main() { int material = 40; int colors; cin>>colors; int cost1 = (colors*5)+ material; int total_cost = cost1/10 + cost1; cout<<total_cost; return 0; } Paint costs

3rd Jan 2020, 12:38 PM
Tanmay Gupta
Tanmay Gupta - avatar
5 Réponses
+ 1
Tax for that you are caluating is missing % calculation. And the total, you need to round up Like use ceil function... Means 4.4455 to 5.0 Try it and give a reply......
3rd Jan 2020, 12:55 PM
Jayakrishna 🇮🇳
+ 2
It is solving 3 cases 1,2,5 but not the 3,4 the hidden cases.
3rd Jan 2020, 12:39 PM
Tanmay Gupta
Tanmay Gupta - avatar
+ 2
Tax is included in the total_cost as cost1/10 or cost*10/100 is the same
4th Jan 2020, 4:56 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 2
How can I use the ceil function to round off to the nearest integer
4th Jan 2020, 4:57 AM
Tanmay Gupta
Tanmay Gupta - avatar
+ 1
#include <cmath> allows you to use the ceil function
4th Jan 2020, 5:31 AM
Steven Jacobsen
Steven Jacobsen - avatar