remainder(): This method is available in java.math.BigInteger class of Java.
Syntax:
BigInteger java.math.BigInteger.remainder(BigInteger val)
This method takes one argument of type BigInteger as its parameter. This method returns a BigInteger whose value is (this % val).
Parameters: One parameter is required for this method.
val: value by which this BigInteger is to be divided, and the remainder computed.
Returns: this % val.
Throws: ArithmeticException - if val is zero.
For Example:
BigInteger bigInteger = new BigInteger("1234")
BigInteger val = new BigInteger("17")
bigInteger.remainder(val) = > It returns 10.
Approach
Java
import java.math.BigInteger;public class BigIntegerremainder {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("1234");BigInteger val = new BigInteger("17");System.out.println(bigInteger.remainder(val));}}
Output:
10
No comments:
Post a Comment