-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArithmetic.java
More file actions
33 lines (20 loc) · 852 Bytes
/
Arithmetic.java
File metadata and controls
33 lines (20 loc) · 852 Bytes
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
import java.util.Scanner;
public class Arithmetic{
public static void main(String[] args){
Scanner userInput;
userInput = new Scanner(System.in);
System.out.print("Prompt the user to enter firtst integer: ");
int newNumber1 = userInput.nextInt();
System.out.print("Prompt the user to input second integer: ");
int newNumber2;
newNumber2 = userInput.nextInt();
int squared1 = newNumber1 * newNumber1;
System.out.println("The square of the first integer is: " + squared1);
int squared2 = newNumber2 * newNumber2;
System.out.println("The square of the second integer is: " + squared2);
int sumOfSquares = squared1 + squared2;
System.out.println("The sum of the squares of the integers is: " + sumOfSquares);
int diffOfSquares = squared1 - squared2;
System.out.println("The difference of the squares of the integers is: " + diffOfSquares);
}
}