- 2
Hi guys
I don't know what is wrong with my coding I need help
6 odpowiedzi
+ 5
You might want to show your code as well, so that we can take a look at what is wrong.
+ 3
You were declaring days, hours, etc in String on the second line in main, probably don't need that. You also don't need to assign 12 to days, since you were taking input and storing that into days already. Your result variable lacks a name and on your print statement, you are printing a raw string. Minutes probably shouldn't be 17280 (you only have 60 minutes in an hour)...
0
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//your code goes here
int days = scanner.nextInt();
String days,hours,minutes,seconds;
int days =12;
int hours =24;
int minutes =17280;
int seconds =60;
int =("days*hours*minutes*seconds");
System.out.println("seconds");
}
}
0
The question is 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
Explanation: 12 days are 12*24 = 288 hours, which are 288*60 = 17280 minutes, which are 17280*60 = 1036800 seconds.
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