+ 5
The below code used in code coach for cost of paints. my out put is same as result output but it not executed why?
#include <stdio.h> int main() { int n,num,money,tax,brushes_canvas=40; printf("enter number of colours\n"); scanf("%d",&n); num=n*5+brushes_canvas; tax=num/10; money=tax+num; printf("money required=%d",money); return 0; }
3 Respostas
+ 5
//You have to round the result as in description mentioned:
#include<stdio.h>
#include<math.h>
int main()
{
float paints;
scanf("%f",&paints);
float cost=round((paints*5+40)*11/10);
printf("%.f",cost);
}
+ 2
Thanks a lot for ur suggestion JaScript 😊..
+ 1
the code seems to be fine. you may typecast tax:
tax = (int)(num/10);
sometimes the "/" operator may cause trouble to integers. just an idea but it might not make any difference anyway.