Java BigInteger

Sort by

recency

|

347 Discussions

|

  • + 0 comments

    Consider this solution as reference,

        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            BigInteger first = new BigInteger(sc.next());
            BigInteger second = new BigInteger(sc.next());
            System.out.println(first.add(second));
            System.out.println(first.multiply(second));
       }
    
  • + 0 comments

    import java.io.; import java.util.; import java.util.Scanner; import java.math.BigInteger; public class Solution {

    public static void main(String[] args) {
            /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
            Scanner sc= new Scanner(System.in);
            BigInteger a = sc.nextBigInteger();
            BigInteger b = sc.nextBigInteger();
            BigInteger sum, mul;
            sum = a.add(b);
            mul = a.multiply(b);
            System.out.println(sum + "\n" + mul);
    }
    

    }****

  • + 0 comments
    
    

    import java.util.; import java.text.; import java.math.; import java.util.regex.;

    public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner sc = new Scanner(System.in);
        BigInteger a = new BigInteger(sc.nextLine());
        BigInteger b = new BigInteger(sc.nextLine());
         BigInteger sum = a.add(b);
          BigInteger prod = a.multiply(b);
    
        System.out.println(sum+"\n"+prod);
    }
    

    }

  • + 0 comments

    Scanner sc=new Scanner(System.in); BigInteger b1=sc.nextBigInteger(); BigInteger b2=sc.nextBigInteger(); BigInteger sum=b1.add(b2); BigInteger mul=b1.multiply(b2); System.out.println(sum); System.out.println(mul);

    }
    

    }

  • + 0 comments

    import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;

    public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger bigInt1 = sc.nextBigInteger();
        BigInteger bigInt2 = sc.nextBigInteger();
        BigInteger sum = bigInt1.add(bigInt2);
        BigInteger product = bigInt1.multiply(bigInt2);
        System.out.println(sum);
        System.out.println(product);
    }
    

    }