+ 3
You need a program to convert days to seconds. The given code takes the amount of days as input. Complete the code to convert
Could anyone please help me to solve this code..!!! import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); // what code i have to write?? } }
7 Answers
+ 8
int second = days * 24 * 60 * 60;
//Step by step
1 day = 24 hour
1 hour = 60 min
1 min = 60s
+ 2
The explanation is given just below the problem statement, read it.
1 day = 24 hrs
1 hr = 60 min
1 min = 60 sec
+ 2
You have to convert days to seconds. For formula explanation refer the explanation given by Avinesh
+ 1
hmm, i see that you're completed almost entire course aand still can't do that simple project.
+ 1
Well
I studied that in my 2 or 3 class I guess
Sec = days * 24 * 60 * 60