Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerGCDExample3{ public static void main(String[] args){ // create 2 BigInteger objects BigInteger big1= new BigInteger("12"); BigInteger big2= new BigInteger("0"); // get the gcd value of BigInteger big1,big2 BigInteger bigVal= big1.gcd(big2); String str="GCD of "+big1+ " and " +big2+" is "+ bigVal; System.out.println(str); } }
Output