Advertisement
tchenkov

L07u08_Factorial

Feb 21st, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. package Uprajneniq;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * Created by todor on 20.02.2017 г..
  7.  */
  8. public class u08_Factorial {
  9.     public static void main(String[] args) {
  10.         Scanner scan = new Scanner(System.in);
  11.         int factorial = Integer.parseInt(scan.nextLine());
  12.         int result = 1;
  13.         for (int i = 2; i <= factorial; i++) {
  14.             result *= i;
  15.         }
  16.    
  17.         System.out.println(result);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement