-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuiltInBigIntegerFunction.java
More file actions
27 lines (21 loc) · 970 Bytes
/
BuiltInBigIntegerFunction.java
File metadata and controls
27 lines (21 loc) · 970 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
import java.util.Scanner;
import java.math.BigInteger;
public class BuiltInBigIntegerFunction {
public static void main(String cLA[]) {
Scanner myInput = new Scanner(System.in);
BigInteger aBigNumber = myInput.nextBigInteger();
BigInteger anotherBigNumber = myInput.nextBigInteger();
BigInteger summation = aBigNumber.add(anotherBigNumber);
BigInteger subtraction = aBigNumber.subtract(anotherBigNumber);
BigInteger multiplication = aBigNumber.multiply(anotherBigNumber);
BigInteger division = aBigNumber.divide(anotherBigNumber);
BigInteger remainder = aBigNumber.mod(anotherBigNumber);
BigInteger gcd = aBigNumber.gcd(anotherBigNumber);
System.out.printf("Summation %d\n", summation);
System.out.printf("Subtraction %d\n", subtraction);
System.out.printf("Multiplication %d\n", multiplication);
System.out.printf("Division %d\n", division);
System.out.printf("Modulus %d\n", remainder);
System.out.printf("GCD %d\n", gcd);
}
}