0

Can any one help me in this code in c++.

#include <iostream> using namespace std; int naughty(int a){ int total=a*5+40; int percentage=total*10/100; int all=percentage+total; cout <<all; } int main() { int colors; cin >>colors; naughty (colors); return 0; } This is the code of the problem (The paint costs). I have just tried this as using functions.

10th Dec 2020, 2:43 PM
RAVIKIRAN.D
RAVIKIRAN.D - avatar
4 Answers
+ 3
RAVIKIRAN.D U need to Have a check for rounding up to the nearest whole number like : if(total%10<5) ...cout<<all; else ...cout<<all+1;
10th Dec 2020, 2:55 PM
Alphin K Sajan
Alphin K Sajan - avatar
0
Ohh thanks alot
10th Dec 2020, 2:59 PM
RAVIKIRAN.D
RAVIKIRAN.D - avatar
10th Dec 2020, 3:00 PM
Alphin K Sajan
Alphin K Sajan - avatar