Advertisement
rafid_shad

Factorial

Jan 27th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. package Factorial;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Factorial {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner ss = new Scanner(System.in);
  9.         int n = ss.nextInt();
  10.         int sum = 1;
  11.         for (int i = 1; i <= n; i++) {
  12.             sum*=i;
  13.         }
  14.         System.out.println("Fctorial is "+sum);
  15.  
  16.     }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement