Java BigInteger

  Java BigInteger


Problem Description

In this problem, you have to add and multiply huge numbers! These numbers are so big that you can't contain them in any ordinary data types like a long integer.

Use the power of Java's BigInteger class and solve this problem.

Input Format


There will be two lines containing two numbers aa and bb

Constraints:


Aa and bb are non-negative integers and can have maximum 200200 digits.

Output Format


Output two lines.The first line should contain a+ba+b , and the second line should contain abab .Don't print any leading zeros.


Solution


import java.util.Scanner;

import java.io.*;

public class TestClass {

public static void main(String[] args) { 

Scanner sc= new Scanner(System.in); 

       int a= sc.nextInt();

       int b= sc.nextInt();

       int c=a+b;

       int d=a*b;

System.out.println(+c);  

System.out.println(+d);  

     }

}

Post a comment

0 Comments