 Can anyone please help me in java | SoloLearn: Learn to code for FREE!

+1

"Time Converter program" 12days have to convert in seconds

+10

Bhavesh Sove How many second in one minute? How many minutes in one hours? How many hours in one days? If you know this then you can solve how many seconds in 24 hours. If you get seconds of 1 day then you can get of 12 days.

+3

Bhavesh Sove Just read the explanation of that problem which is in yellow colored box . https://www.sololearn.com/coach/948?ref=app

+3

Then use your mathematical knowledge Hint: ``` x = 60 y = 60x z = 24y ```

+2

+2

Thanks everyone ❤️ Special thanks to #yashraj

+2

It will solve your problem!Use it. import java.util.Scanner; public class DaysToSeconds{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int hours = 24; int minutes = 60; int seconds = 60; System.out.println(days*hours*minutes*seconds); } }

+2

import java.util.Scanner; public class MathUnitConversions13 { public static void main(String[] args) { long days; Scanner in = new Scanner(System.in); System.out.println("Please enter days:"); days = in.nextLong(); long seconds = days * 24 * 60 * 60; System.out.println(seconds + " Seconds"); } }

+2

First make use of package then make class,then method main then scanner then 👇👇 int days = scanner.nextInt(); int sec=days*24*60*60; System.out.println(sec); I am telling you this because earlier I was also weak in programing 😅😅😅😅. Final code should be 👇👇👇👇 import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int sec=days*24*60*60; System.out.println(sec); } }

+1

See this! https://code.sololearn.com/crIrSL6MK9S8/?ref=app

+1

in one hour there are 84600 seconds, so the algorithm becomes. Import Java.util.Scanner; Public class Con sec{ Public static void main(String[] args){ Int day = sc.nextInt(); Int sec = day * 84600; System.out.print(sec); } }

0

I know there are - 24hrs in a day 60min in hour 60sec in min But I don't know the method for coding in Java I am confused 🙄

0

public class Program { public static int secondsConvertor(int days){ int sec,mins,hours=24; mins=60; sec=60; return days*hours*mins*sec;}; public static void main(String[] args) { System.out.print(secondsConvertor(12)); } }

0