-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArithmetic.java
More file actions
30 lines (24 loc) · 1.26 KB
/
Arithmetic.java
File metadata and controls
30 lines (24 loc) · 1.26 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
import java.util.Scanner;// the java modulue?? that is used for taking inputs from the terminal/command line
public class Arithmetic
{
public static void main(String[] args)
{
Scanner inputDevice = new Scanner(System.in);
System.out.println("Please enter a number");
int firstNumber = inputDevice.nextInt();
inputDevice.nextLine();
System.out.println("You chose " + firstNumber + " as your first number");
System.out.println("Please enter a second number");
int secondNumber = inputDevice.nextInt();
inputDevice.nextLine();
System.out.println("You chose " + secondNumber + " as your first number");
int sum = firstNumber + secondNumber;
int multiplication = firstNumber * secondNumber;
int dividionFirstBySecond = firstNumber / secondNumber;
int divisionSecondByFirst = secondNumber / firstNumber;
System.out.println(firstNumber + "+" + secondNumber + "=" + sum);
System.out.println(firstNumber + "*" + secondNumber + "=" + multiplication);
System.out.println(firstNumber + "/" + secondNumber + "=" + dividionFirstBySecond);
System.out.println(secondNumber + "/" + firstNumber + "=" + divisionSecondByFirst);
}
}