Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class AAAA {
- public static void main(String args[]) {
- String str;
- int no, fact;
- fact = 1;
- try {
- BufferedReader obj = new BufferedReader(new InputStreamReader(
- System.in));
- System.out.print("Enter number whose Factorial is to be found : ");
- System.out.flush();
- str = obj.readLine();
- no = Integer.parseInt(str);
- while (no > 0) {
- fact = fact * no;
- no = no - 1;
- }
- System.out.println("FACTORIAL of a given number is : " + fact);
- } catch (Exception e) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment