+ 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????

31st Dec 2021, 6:35 PM
Afnan Cherat
7 Answers
+ 6
You have never used the input variable "days"
31st Dec 2021, 6:37 PM
Lisa
Lisa - avatar
+ 4
Read the task description again. You take days input and should calculate how many seconds these days are
31st Dec 2021, 6:42 PM
Lisa
Lisa - avatar
+ 2
Thank you all šŸ˜­
31st Dec 2021, 6:58 PM
Afnan Cherat
+ 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); }
1st Jan 2022, 10:33 AM
Muhammad Rizwan
Muhammad Rizwan - avatar
+ 1
Make that 12 instead of days bro it will work Because your creating the program manual input so mention that manual variable 'days'
1st Jan 2022, 12:48 PM
Udhay Shankar.D
Udhay Shankar.D - avatar
0
I don't understand. Can you give me an example? Please
31st Dec 2021, 6:40 PM
Afnan Cherat