0
What am I doing wrong
You need a program to convert days to seconds. This code uses the number of days as input. Complete the code to convert the number of days to seconds and print the result. Input example: 12 Result example: 1036800 import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int a = sc.nextInt(); int b = (a*24*60*60); System.out.println(b); } }
3 Respostas
+ 4
int b = (days * 24 * 60 * 60);
+ 2
Why are you reading and calculating <a> when you have already read <days>?
What if the test provide you only one input at runtime? what becomes of <a>?
Basically, you get wrong result cause you're supposed to calculate using <days> instead of <a>
+ 2
Thanks you so much!!