public static long Factorial(long val) {
    return val == 1 ? val:val*Factorial(val - 1);
}