class fact { public static void main(String arg[ ]) { for(int i = 0; i <= 10; i++) { System.out.println( i + "! : " + factorial(i)); } } public static long factorial( int n ) { long f = 1; if (n > 1) { int aux = n; while (aux > 1) { f = f * aux; aux--; } } return f; } }