+ 3

Paint Costs

#include<stdio.h> int main() { int n,j,t,c; scanf("%d",&n); j= (n*5)+40; t = j*10/100; c = j+t; printf("%d",c); return 0; What is wrong test case 3-4 got failed in Paint Costs problem

28th May 2020, 6:39 PM
Ambuj Singh
Ambuj Singh - avatar
4 Answers
+ 5
you need to round it up which is an instruction on the challenge #include<stdio.h> #include <math.h> int main() { int n,j,c; float t; scanf("%d",&n); j= (n*5)+40; t = ceil(j*0.1); c = j+t; printf("%d",c); return 0; }
28th May 2020, 8:12 PM
āœ³AsterisKāœ³
āœ³AsterisKāœ³ - avatar
+ 1
thanks āœ³AsterisKāœ³ but i had already done it :)
28th May 2020, 8:19 PM
Ambuj Singh
Ambuj Singh - avatar
+ 1
Try adding the round() function under math.h header
11th Jun 2020, 5:25 AM
ANKIT DATTA
ANKIT DATTA - avatar
0
Hello Ambuj Singh. The truth is I don't know about the C language. I tried to solve it but I can't solve a type error. Your code needs to be rounded according to the instructions. I already imported the math bookstore. I hope that with my little help you can solve it. Check my code. https://code.sololearn.com/c82EYN9FSeq9/?ref=app
28th May 2020, 7:04 PM
Josshual A. Toro M.
Josshual A. Toro M. - avatar