+ 2

Paint costs test case failed

Code coach problem " paint costs " Why my code fails in Test case 3, test case 4 #include <iostream> using namespace std; int main() { int a; int r ; cin>> a; r = (((a*5)+40) + ((a/2)+4)); if(a<1){ cout<<"44"; } else{ cout <<""<<r; } return 0;

19th Sep 2020, 10:23 AM
Mantu kumar
Mantu kumar - avatar
5 Respostas
+ 2
You forget to roundup final value and you also missed one curly bracket after return statement.
19th Sep 2020, 10:37 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
19th Sep 2020, 10:24 AM
Mantu kumar
Mantu kumar - avatar
+ 1
Snehal what happened...?
19th Sep 2020, 10:25 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
🗡️Jasprit test case 3 and test case 4 showing error
19th Sep 2020, 10:32 AM
Mantu kumar
Mantu kumar - avatar
0
Total cost is a*5+40 but find the tax for this and add to total then round up* results, use ceil function. Adding a/2 + 4 may work for single case but it should work for all cases...
19th Sep 2020, 2:20 PM
Jayakrishna 🇮🇳