+ 1
[Solved] Paint cost 2/5 failed
#include <stdio.h> int main() { int colours, total, other_stuff=40, final, tax; scanf("%d",&colours); total = (colours*5) + other_stuff ; tax = total/10; final = tax + total; printf ("%d",final); return 0; } 2 out of 5 case failed Pls help
2 Réponses
+ 2
Coder Kitten Is there any way without using ceil?
+ 2
Coder Kitten
#include <stdio.h>
#include <math.h>
int main() {
int colours, total, other_stuff=40, a;
double tax, final;
scanf("%d",&colours);
total = (colours*5) + other_stuff ;
tax = total/10.0;
final = tax + total;
a = ceil(final);
printf ("%d",a);
return 0;
}
This is the new code and it works thank you