import org.pureprogrammer.Utils; public class Functions5 { static long factorial(int x) { if (x <= 1) { return 1; } return x * factorial(x - 1); } public static void main(String[] args) { for (int x = 1; x < 10; ++x) { System.out.println(Utils.format("{0:d}! = {1:d}", x, factorial(x))); } } }