import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*
 * Fakultaet.java
 *
 */

/**
 *
 * @author  Christian Weidauer
 */
public class Fakultaet {
   
   
   /**
    * @param args the command line arguments
    */
   public static void main(String[] args) throws IOException {        
        System.out.print("Geben Sie bitte eine positive Zahl ein: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int zahl = Integer.parseInt(in.readLine());

        if (zahl >= 0) {
           System.out.println("Die Fakultät von " + zahl + " ist " + fak (zahl) + ".");
        } else {
           System.out.println ("Eine negative Zahl ist zur Fakultätsberechnung unzulässig!");           
        }
   }
   
   public static int fak(int n) {
      int fak = 1;
      for (int i=2; i <= n; i++) {
         fak = fak * i;
      }
      return fak;
   }

}
