0
Can somebody plz help me with this?
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 } } /*Explanation: 12 days are 12*24 = 288 hours, which are 288*60 = 17280 minutes, which are 17280*60 = 1036800 seconds.*\ https://www.sololearn.com/discuss/2901794/?ref=app
8 odpowiedzi
+ 1
Explanation is clear ...
Multiply number-of-days by 24 to get number-of-hours
Multiply number-of-hours by minutes-in-one-hour to get number-of-minutes
Multiply number-of-minutes by number-of-seconds-in-one-minute
And you get it ...
What is the problem?
+ 1
I've provided you the blow-by-blow hint. You could just give it a try now
+ 1
Okay so you're having difficulty on implementation ...
Have you tried searching the forum for similar discussions? I am sure someone had attempted this challenge and posted similar questions. If you find one, you might also find an example.
Even better, try searching the Code Playground, someone must've uploaded their work on this case.
+ 1
By the way I finally figured out how to get correct output. It wasn't the math that was boggling me, it was my variable... I kept declaring an int when it should have been a long... I've enclosed and ty again (AND I know this may seem very simple to a lot of the more advanced coders on here but I just started);
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
long seconds = days*24*60*60;
System.out.println(seconds);
//your code goes here
0
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
0
Then you have to write code in order to output... I understand the math I just can't figure out how to pass the challenge on here...
0
I understand that I don't know how to implement it into my code to get a proper output
0
Here is an example based on your code.
https://code.sololearn.com/ckueZcqvV8ed/?ref=app