Paint Costs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
6th Apr 2020, 4:23 PM
Kuldeep Sahani
5 Answers
+ 2
Hello Kuldeep Sahani It would be nice if you could explain the issue with your code :) Btw: Please delete this question:
6th Apr 2020, 4:31 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2 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
6th Apr 2020, 4:41 PM
Utkarsh Sharma
Utkarsh Sharma - avatar
+ 2
Try using the round() function under math library
11th Jun 2020, 5:22 AM
ANKIT DATTA - avatar
+ 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.
6th Apr 2020, 4:32 PM
Taranjeet - avatar
6th Apr 2020, 4:35 PM
Kuldeep Sahani