Advertisement
YORDAN2347

Factorial

Nov 18th, 2020
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Scratch {
  4.     public static void main(String[] args)
  5.     {
  6.         Scanner scan = new Scanner(System.in);
  7.         int fac = scan.nextInt();
  8.         int sum = 1;
  9.         for(int i = 1;i <= fac; i ++) {
  10.             sum *= i;
  11.         }
  12.         System.out.println(sum);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement