0
Paint Costs
Test case failing. https://code.sololearn.com/c7y2RZ23Sd2H/?ref=app
5 ответов
+ 2
Hello Kuldeep Sahani
It would be nice if you could explain the issue with your code :)
Btw: Please delete this question:
https://www.sololearn.com/Discuss/2230062/?ref=app
+ 2
https://code.sololearn.com/c0r95wui2Kx7/?ref=app
I have changed == to =
total was defined two times. Once as float and other time as int
Changed some logic to find total
and used ceil() function to round the answer
+ 2
Try using the round() function under math library
+ 1
#include <stdio.h>
int main() {
int cab=40,paint=5;
int npaint;
float tax=0.1;
scanf("%d",&npaint);
int tpaint=paint*npaint;
float total=cab+tpaint+(cab+tpaint)*tax;
printf("%f",total);
return 0;
}
I have done some changes. First, you used "==" instead of "=". Double equal to is used for comparison, but you want to assign the values. So you should use "=". Second, you had defined total in two different types, that is, float and int. So I removed the total in int.
Rest you can check. Hope this helps.
0
Thanks