+ 1

Paint costs.

https://sololearn.com/coach/22/?ref=app Either 4/5 or 3/5. Why can’t I get 5/5? Any ideas?

9th Jan 2022, 5:30 AM
Amber Singh Rathour Pandey
Amber Singh Rathour Pandey - avatar
9 Respuestas
0
int main() { int canvas = 40; int color = 5; int colors; cin >> colors; int total = canvas + (colors*color); double with_tax = total + (total*0.1); //int with_tax = total + (total*0.1); cout << int(round(with_tax))<< endl; return 0; } Guys, we got him! 5/5. Now I don’t care why this does work?😂
9th Jan 2022, 6:27 AM
Amber Singh Rathour Pandey
Amber Singh Rathour Pandey - avatar
+ 6
cout << int(round(with_tax))<< endl;
9th Jan 2022, 6:02 AM
Simba
Simba - avatar
+ 3
Can you please show your attempt.
9th Jan 2022, 5:31 AM
Ananya | Inactive |
Ananya | Inactive | - avatar
+ 2
#include <math.h> And then round(with_tax) "Output Format A number that represents the cost of your purchase rounded up to the nearest whole number."
9th Jan 2022, 5:47 AM
CGM
CGM - avatar
+ 2
What? But I just did ... Could it be because you store it as a double? Try rounding first then storing it as int
9th Jan 2022, 5:58 AM
CGM
CGM - avatar
0
int main() { int canvas = 40; int color = 5; int colors; cin >> colors; int total = canvas + (colors*color); //double with_tax2 = total + (total*0.1); (with this I am getting first two test correct) int with_tax = total + (total*0.1);(with this, first two and fifth one is correct) cout << with_tax<< endl; (If I try to print with round(with_tax), I get first 4 tests correct.) //cout<< with_tax2<<endl; return 0; }
9th Jan 2022, 5:38 AM
Amber Singh Rathour Pandey
Amber Singh Rathour Pandey - avatar
0
Cristian Gabriel Mazzulla #include <iostream> #include<cmath> using namespace std; int main() { int canvas = 40; int color = 5; int colors; cin >> colors; int total = canvas + (colors*color); double with_tax = total + (total*0.1); //int with_tax = total + (total*0.1); cout << round(with_tax)<< endl; //cout<< with_tax2<<endl; return 0; } With some changes, it’s 4/5. The first 4 tests passed.
9th Jan 2022, 5:54 AM
Amber Singh Rathour Pandey
Amber Singh Rathour Pandey - avatar
0
5/5
9th Jan 2022, 3:02 PM
K RAMALAKSHMI
K RAMALAKSHMI - avatar
- 1
#include <stdio.h> #include<math.h> int main() { int x,r; float c,y; scanf("%d",&x); c=(x*5)+40; y=c+c/10; r=round(y); printf("%d",r); return 0; }
9th Jan 2022, 3:01 PM
K RAMALAKSHMI
K RAMALAKSHMI - avatar