import java.util.*;
import java.lang.Math;
public class Factorial
{
//Constants
public static final String REPORT = "\nFactorial of ";
public static void main(String[] args)
{
String userInputStr;
int userNum, fact;
Scanner inputStream = new Scanner(System.in);
while(true)
{
System.out.print("\nInput an integer: ");
userInputStr = inputStream.nextLine();
userNum = Integer.parseInt(userInputStr);
fact = findFact(userNum);
System.out.print(REPORT + userNum +" is "+fact);
System.out.print("\nContinue(Yes/No)? ");
userInputStr = inputStream.nextLine();
char a = userInputStr.charAt(0);
if ((a == 'y') || (a == 'Y'))
{
System.out.print(userInputStr+"\n");
}
if ((a == 'n') || (a == 'N'))
{
System.out.print(userInputStr);
break;
}
}
}
static int findFact(int n)
{
int f = 1;
for (int i=1; i<n+1; i++)
{
f = f * i;
}
return f;
}
}
Factorial.main(null);