+ 1
Help me please
Hey, friends, I'm new to Java, and I had a problem, and I didn't know the solution. The problem 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 I wrote this code: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); int days = input.nextInt(); int hours = 24*12; int minutes = 60*24*12; int seconds = 60*60*24*12; System.out.println(seconds); } Where is the problem????
7 Respostas
+ 6
You have never used the input variable "days"
+ 4
Read the task description again. You take days input and should calculate how many seconds these days are
+ 2
Thank you all 😭
+ 2
import java.util.Scanner;
public class Program
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int days=input.nextInt();
int hours=24;
int minutes=60*hours;
int seconds=60*minutes;
System.out.println(days*seconds);
}
+ 1
Make that 12 instead of days bro it will work
Because your creating the program manual input so mention that manual variable 'days'
0
I don't understand. Can you give me an example? Please