+ 1
Fron sololearn code coach paint costs
import java.util.*; public class Program { public static void main(String[] args) { Scanner sc=new Scanner (System.in); int a = sc.nextInt(); int b = a*5+40; double c =(10*b/100); int d = (int)c; int e = d+b; System.out.println(e); } } Test cases 3 and 4 are failing every time.....
1 ответ
+ 2
10*b/100 result integer value then stored in c as double value so by that you miss fraction parts..
For ex: if a=3
b=55
c=550/100=>5.0 but you need here as 5.5
Next You need 5.5+55=60.5
This result should be rounded up =>60.5=>61.0
Here now convert to int then print result 61
Make changes according to this example...