Skip to content

Instantly share code, notes, and snippets.

@camilojm27
Created July 4, 2019 23:53
Show Gist options
  • Save camilojm27/4c6fed01e8a1428f890edd193ee4d41c to your computer and use it in GitHub Desktop.
Save camilojm27/4c6fed01e8a1428f890edd193ee4d41c to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner escanercito = new Scanner(System.in);
while (escanercito.hasNextInt()){
int number1, number2;
number1 = escanercito.nextInt();
number2 = escanercito.nextInt();
System.out.println(bigSum(number1,number2));
}
System.out.println(fac(7));
}
public static BigInteger fac(int numero){
if(numero == 0){
return BigInteger.ONE;
}
return BigInteger.valueOf(numero).multiply(fac(numero - 1));
}
public static BigInteger bigSum(int number1, int number2){
BigInteger bigSum = fac(number1).add(fac(number2));
return bigSum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment