Java BigInteger

윤지현·2025년 3월 14일
0

HackerRank[Java]

목록 보기
16/57
  • 문제
  • 정답
import java.io.*;
import java.util.*;
import java.math.*;

public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String num1 = sc.nextLine();
        String num2 = sc. nextLine();
        
        BigInteger a = new BigInteger(num1);
        BigInteger b = new BigInteger(num2);
        
        BigInteger sum = a.add(b);
        BigInteger product = a.multiply(b);
        
        System.out.println(sum);
        System.out.println(product);
        
        sc.close();
    }
}
  • 결과
profile
첫 시작

0개의 댓글