Generation

generate functionTue, 24 Jan 2023

Two positive integer values a,b (a≧b) with 100 digits or less on standard input. A program that calculates the difference (a-b) and prints it to standard output.

import java.lang.Math; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main (String [] args) { Scanner scanner = new Scanner(System.in); String a = scanner.nextLine(); String b = scanner.nextLine(); BigInteger bigA = new BigInteger(a); BigInteger bigB = new BigInteger(b); System.out.println(bigA.subtract(bigB)); } }

Want to kickstart your project?Use the new AI Studio to create your code