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);
Input an integer: 
Factorial of 7 is 5040
Continue(Yes/No)? Yes

Input an integer: 
Factorial of 4 is 24
Continue(Yes/No)? yeah

Input an integer: 
Factorial of 9 is 362880
Continue(Yes/No)? noo