Java BigInteger

Sort by

recency

|

360 Discussions

|

  • + 0 comments

    Remember import java.math.*;

  • + 0 comments

    Here's the code

    import java.util.*;
    import java.math.*;
    
    public class Solution {
    
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            
            BigInteger num1 = sc.nextBigInteger();
            BigInteger num2 = sc.nextBigInteger();
            sc.close();
            
            System.out.println(num1.add(num2));
            System.out.println(num1.multiply(num2));
        }
    }
    
  • + 0 comments

    This is a great problem to get hands-on with Java's BigInteger class! It's amazing how easily it handles operations on numbers that go far beyond the range of standard data types. 11xplay black

  • + 0 comments

    Here is Java BigInteger solution - https://programmingoneonone.com/hackerrank-java-biginteger-problem-solution.html

  • + 0 comments
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            BigInteger a= scanner.nextBigInteger();
            BigInteger b= scanner.nextBigInteger();
            System.out.println(a.add(b));
            System.out.println(a.multiply(b));
            scanner.close();
        }