0
* and / using scanner
How can I * or / using scanner? I have defined int day = scanner.nextint(); Day = 10 System.out.println(Day); And when I run program whatever I write for example 3 or 5 result of program will be always 10. I want it to be 30 or 50. How can I do this ?
2 Answers
+ 3
Try this
int day = scanner.nextInt();
int Day = 10;
System.out.println(Day*day);
//System.out.println(Day/day);
+ 1
// and it works ;););) you can check how many seconds has 10 days for example ;););) thx
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
int second = 1;
int minute = 60* second;
int hour = 60 * minute;
int day = 24 * hour;
System.out.println( days * day);
//your code goes here
}
}