Advertisement
Waliullah8328

Determine factorial value

Jan 24th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package basicdata1;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Factorial {
  6.     public static void main(String[] args) {
  7.         Scanner input = new Scanner(System.in);
  8.         int a,fact=1;
  9.         System.out.print("Enter your Number : ");
  10.         a = input.nextInt();
  11.         for (int i = a; i >= 1; i--)
  12.         {
  13.         fact = fact * i;    
  14.         }
  15.         System.out.println("Factorial Value : " +fact);
  16.     }
  17.    
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement