xxxxxxxxxx
Time Converter
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
Explanation: 12 days are 12*24 = 288 hours, which are 288*60 = 17280 minutes, which are 17280*60 = 1036800 seconds.
xxxxxxxxxx
days = input("Number of days\n")
seconds = days * 24 * 60 * 60 # your answer :)
print(seconds) # you can check this by printing, if you want...
xxxxxxxxxx
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
int hour , minute , second;
hour=days*24;
minute=hour*60;
second=minute*60;
system.out.println(days +"days" +hour + "hour" + minute + "minute" + second + "second");
scanner.close();