- 1
Can't passed by the Hidden TestCase #3 and #4
https://www.sololearn.com/coach/22?ref=app // I've done following code in Java for the above codeCoach. import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int colors = sc.nextInt(); int colorsCost = colors *5; int projectCost = colorsCost +40; int storeTax = projectCost *10/100; int totalCost = storeTax +projectCost; System.out.println(totalCost); } }
2 Réponses
+ 1
use double instead of int for variables since a division is used.
then round up the result and output an int.
System.out.println((int)Math.ceil(totalCost));
Math.ceil() to round up
(int) to cast double to int.
0
I've no approach in math.ciel yet.