Time Converter (Need Help to Solve) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 5

Time Converter (Need Help to Solve)

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

13th Oct 2021, 7:06 PM
Sandeep Durge
Sandeep Durge - avatar
11 Answers
+ 8
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int hours = days * 24; int minutes = 60 * hours; int seconds = 60 * minutes; System.out.print(seconds); } }
15th Oct 2021, 8:36 AM
Emiliano Rodriguez
Emiliano Rodriguez - avatar
+ 1
Sandeep Durge you made a few mistakes, I have corrected it, do analyse and write yourself again. https://code.sololearn.com/cT7oIGp5tA9J/?ref=app
13th Oct 2021, 8:23 PM
Saurabh
Saurabh - avatar
+ 1
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); //your code goes here System.out.println(days*24*60*60); } }
19th Sep 2022, 3:27 PM
GOVARTHANA S
GOVARTHANA S - avatar
0
Saurabh Kumar Yadav import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); String x = 12*24 String y = 60*60 String z = x * y } }
13th Oct 2021, 8:16 PM
Sandeep Durge
Sandeep Durge - avatar
0
Thank you Emiliano Rodriguez for being a helping hand to make me grow and move forward. 🙏🏼
15th Oct 2021, 11:52 AM
Sandeep Durge
Sandeep Durge - avatar
0
Hey Sandeep Durge I have already mentioned your mistakes 1 day ago, also corrected it, you didn't responded to that whether you understood or not???!
15th Oct 2021, 2:08 PM
Saurabh
Saurabh - avatar
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int daysHours = days*24; int daysMinutes = daysHours*60; int daysSeconds = daysMinutes*60; System.out.println(daysSeconds); } }
16th Jun 2022, 10:29 PM
Avanti Mitchell
Avanti Mitchell - avatar
0
hello
15th Sep 2022, 8:49 AM
Abdulmumini Ismail Ishaq
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); //your code goes here int hours = 24 * days; int minutes = 60 * hours; int seconds = 60 * minutes System.out.println(seconds); } }
28th Mar 2023, 9:27 PM
OLEH MOROZ
OLEH MOROZ - avatar
- 1
Can you please share your attempt?
13th Oct 2021, 7:50 PM
Saurabh
Saurabh - avatar
- 1
int hours; int minutes; int seconds; Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); hours = days * 24; minutes = hours * 60; seconds = minutes*60; System.out.println("result : " + seconds);
1st Nov 2022, 2:33 PM
khefacha soumeya
khefacha soumeya - avatar