Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package basicdata1;
- import java.util.Scanner;
- public class Factorial {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int a,fact=1;
- System.out.print("Enter your Number : ");
- a = input.nextInt();
- for (int i = a; i >= 1; i--)
- {
- fact = fact * i;
- }
- System.out.println("Factorial Value : " +fact);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement