UVA 568 - Just the Facts UVA • Sep 1, 2020 Problem PDFSolution: package mypkg; import java.util.Scanner; import java.math.BigInteger; class Main { public static void main(String[] args) { Scanner x=new Scanner(System.in); while(x.hasNext()) { BigInteger f=BigInteger.ONE; BigInteger last=BigInteger.ZERO; int n=x.nextInt(); for(int i=1;i<=n;i++) { f=f.multiply(BigInteger.valueOf(i)); } while(last.compareTo(BigInteger.ZERO)==0) { last=f.mod(BigInteger.TEN); f=f.divide(BigInteger.TEN); } if(n<10) System.out.println(" "+n+" -> "+last); else if(n<100) System.out.println(" "+n+" -> "+last); else if(n<1000) System.out.println(" "+n+" -> "+last); else if(n<10000) System.out.println(" "+n+" -> "+last); else System.out.println(n+" -> "+last); } } } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/568/Main.java Tags UVA Competitive Programming Shipu Ahamed Recommended for you UVA UVA 913 - Joana and the Odd Numbers 4 years ago • 1 min read UVA UVA 871 - Counting Cells in a Blob 4 years ago • 3 min read UVA UVA 866 - Intersecting Line Segments 4 years ago • 3 min read