Java BigInteger

Sort by

recency

|

361 Discussions

|

  • + 0 comments

    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

    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