- 2
Java problem
You need a program to convert days to seconds. The given code takes the amount of days as input. Complete the code to convert it to seconds and output the result. Sample Input: 12 Sample Output: 1036800
12 Answers
+ 3
12 days => 1036800sec
1 day = 24 hours
1 Hour = 60 mins
1 min = 60 seconds..
Now you can find correct solution I think...
+ 1
Where is your try.. ? Try it yourself first and post your attempt...
+ 1
12 days => 1036800sec
1 day = 24 hours
1 Hour = 60 mins
1 min = 60 seconds..
Now you can find correct solution I think...
0
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
System .out.println (days);
//your code goes here
int hours = 60;
int mins=60;
int res=days*hours*mins;
System.out.println(res);
}}
0
I try but error still exists
0
Hi! How many hours in one day?
0
24
0
Use this in your formula
0
How?!!
0
See here,just to add 24*days
https://code.sololearn.com/cnydXczDGjIJ/?ref=app
0
Multiply days to minutes and minute's to seconds
0
And add all together!!