-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSDPR.java
More file actions
36 lines (25 loc) · 1015 Bytes
/
SDPR.java
File metadata and controls
36 lines (25 loc) · 1015 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
34
35
36
import java.util.Scanner;
public class ArithmeticOperations {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the first integer: ");
int num1 = scanner.nextInt();
System.out.print("Enter the second integer: ");
int num2 = scanner.nextInt();
int sum = num1 + num2;
int difference = num1 - num2;
int product = num1 * num2;
if (num2 != 0) {
int quotient = num1 / num2;
int remainder = num1 % num2;
System.out.println("Sum: " + sum);
System.out.println("Difference: " + difference);
System.out.println("Product: " + product);
System.out.println("Quotient: " + quotient);
System.out.println("Remainder: " + remainder);
} else {
System.out.println("Division and modulus by zero are not allowed.");
}
scanner.close();
}
}