Java BigInteger

  • + 29 comments

    Got the answer!

    Try the followig code and it will pass all test cases too

    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 bi1 = new BigInteger(sc.next());
         BigInteger bi2 = new BigInteger(sc.next());
    
            BigInteger  bi3, bi4;
            bi3 = bi1.add(bi2);
            bi4 = bi1.multiply(bi2);
            System.out.println( bi3);
            System.out.println( bi4);
    
    
    }
    

    }