-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMath.java
More file actions
50 lines (35 loc) · 1.44 KB
/
Math.java
File metadata and controls
50 lines (35 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.Scanner;
public class Math {
/*public static void main(String[] args) {
//This reads the input provided by user using keyboard
Scanner scan = new Scanner(System.in);
System.out.print("Enter first number: ");
// This method reads the number provided using keyboard
int num1 = scan.nextInt();
System.out.print("Enter second number: ");
int num2 = scan.nextInt();
// Closing Scanner after the use
scan.close();
// Calculating product of two numbers
int product = num1*num2;
// Displaying the multiplication result
System.out.println("Output: "+product);
}*/
public static void main(String[] args) {
/* This reads the input provided by user
* using keyboard
*/
Scanner scan = new Scanner(System.in);
System.out.print("Enter first number: ");
// This method reads the number provided using keyboard
double num1 = scan.nextDouble();
System.out.print("Enter second number: ");
double num2 = scan.nextDouble();
// Closing Scanner after the use
scan.close();
// Calculating product of two numbers
double product = num1*num2;
// Displaying the multiplication result
System.out.println("Output: "+product);
}
}