boolean checkFactorial(int n) { int fac = 1; int i = 2; while (fac < n) { fac *= i++; } return (fac == n); }