Write a program to find the factorial of a given number. If the input number is negative or zero, then return -1
.
class Factorial
{ public static void main(String s[])
{
System.out.println("Factorial of 5 is " + factorial(5));
}
public static int factorial(int number)
{
int result = 1;
//Write code here to find the factorial of given number and assign it to result
return result;
}
}