0
Code coach problem-
https://www.sololearn.com/coach/22?ref=app This is my solution - #include <stdio.h> int main() { int col_n; scanf("%d", &col_n); int cost = 40 + col_n *5 + ((40 + col_n*5)*10)/100; printf("%d\n", cost); return 0; } The result section is showing two failed cases(case 3, 4) Please guide me.
6 Respuestas
+ 2
Because you have to rounded up to the nearest whole number.
For example:
if the answer is 88.32
You have to give output 89.
You are using int instead of double .That's why I guess your answer is not right.
+ 2
Spirit yes that's the trick .I just gave you a hint but I can give you the answer which is against in sololearn rules .Best of luck.
+ 2
Okay I am giving you some suggestion .I think you understand you have to round the decimal number to the next number .So you can use google to find how to round up double .I hope you understand .
Also use printf("%0.0lf) for 0 decimal .
0
Samsil Arefeen but declaring cost as a double variable causing failed cases too.
better if you elaborate it further.
0
Samsil Arefeen but your hint is of no good for me.
0
Okay