Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*This program finds factorial of given no. */
- import java.util.Scanner;
- class Factorial
- {
- public static void main(String args[])
- {
- Scanner sc=new Scanner(System.in);
- int num = sc.nextInt();
- int result = 1;
- while(num>0)
- {
- result = result * num;
- num--;
- }
- System.out.println("Factorial of Given no. is : "+result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement