+ 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?? } }

11th Feb 2021, 12:04 PM
Sri Laya
Sri Laya - avatar
7 Réponses
+ 8
int second = days * 24 * 60 * 60; //Step by step 1 day = 24 hour 1 hour = 60 min 1 min = 60s
12th Feb 2021, 5:26 PM
Wei Phyo Aung
Wei Phyo Aung - avatar
+ 2
The explanation is given just below the problem statement, read it. 1 day = 24 hrs 1 hr = 60 min 1 min = 60 sec
11th Feb 2021, 12:18 PM
Avinesh
Avinesh - avatar
+ 2
You have to convert days to seconds. For formula explanation refer the explanation given by Avinesh
11th Feb 2021, 12:31 PM
Atul [Inactive]
12th Feb 2021, 5:58 PM
Varnica Gupta
Varnica Gupta - avatar
+ 1
hmm, i see that you're completed almost entire course aand still can't do that simple project.
11th Feb 2021, 12:08 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Well I studied that in my 2 or 3 class I guess Sec = days * 24 * 60 * 60
12th Feb 2021, 8:20 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar