- 5
Time Converter (Need Help to Solve)
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
12 Answers
+ 8
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
int hours = days * 24;
int minutes = 60 * hours;
int seconds = 60 * minutes;
System.out.print(seconds);
}
}
+ 1
Sandeep Durge you made a few mistakes, I have corrected it, do analyse and write yourself again.
https://code.sololearn.com/cT7oIGp5tA9J/?ref=app
+ 1
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
System.out.println(days*24*60*60);
}
}
0
Saurabh Kumar Yadav
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
String x = 12*24
String y = 60*60
String z = x * y
}
}
0
Thank you Emiliano Rodriguez for being a helping hand to make me grow and move forward. đđŒ
0
Hey Sandeep Durge I have already mentioned your mistakes 1 day ago, also corrected it, you didn't responded to that whether you understood or not???!
0
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
int daysHours = days*24;
int daysMinutes = daysHours*60;
int daysSeconds = daysMinutes*60;
System.out.println(daysSeconds);
}
}
0
hello
0
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
int hours = 24 * days;
int minutes = 60 * hours;
int seconds = 60 * minutes
System.out.println(seconds);
}
}
0
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int hours=24, minutes=60, seconds=60;
int days = scanner.nextInt();
//your code goes here
System.out.println(days * hours * minutes * seconds);
}
}
thanks you
budhabhushan waghmare
tech brain booster
- 1
Can you please share your attempt?
- 1
int hours;
int minutes;
int seconds;
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
hours = days * 24;
minutes = hours * 60;
seconds = minutes*60;
System.out.println("result : " + seconds);