0
Guys i need help to write a program to convert days to seconds. The given code takes the amount of days as input.
I am trying a lot but not getting solution because i am new to coding.
7 Antworten
0
how many hours in a day?
how many minutes in an hour?
how many seconds in a minutes?
just multiply number of days by hours per day by minutes per hour and by seconds in a minute...
0
Thanks for help but i did all this,
Can not make it in code.
If input is = 2
Then ans should be= 2x24x60x60
I know this.
Unable complete with code.
0
share your code to get more accurate answer ^^
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
}
}
0
this is not your code attempt, this is the code template provided to you...
0
Yes you are right.
In between i use
Int a= 2
Int b= 24
Int c= 60
Int d= 60
And then i multiplied all these var.
To get answer but code has error.
0
in the code template you have the 'days' variable initialized with user input... that's the one you should use to compute the number of seconds:
days*24*60*60
the result of this expression should be outputed...