monkeyslut45

Кирилл Деменев

Nov 12th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     static int factorial(int a, int b){
  8.         for(int i=1; i<=a;i++){
  9.             b=i*b;
  10.         }
  11.         return b;
  12.     }
  13.  
  14.     public static void main(String[] args) {
  15.  
  16.         Scanner in = new Scanner(System.in);
  17.  
  18.         int a =in.nextInt();
  19.         int b=1;
  20.         System.out.println(factorial(a,b));
  21.     }
  22. }
Add Comment
Please, Sign In to add comment