Java Blog

 
 
 
import java.io.*;

class  Factorial
{
    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)
            {}
    }
}

    Related Post:
  1. Write a program for restaurant

  2. Program that accepts a shopping list of items from the command line and stores them in a vector. Also provide facility to perform operation

  3. Program to show some properties of StringBuffer object

  4. RMI application for getting the final total price of the shopping list with some of the following items and quantities chosen by the user

  5. Program that demonstrates type casting

  6. Program that reads and writes random access file

  7. Program to show an example of getting at characters in a String

  8. corba program of client and a DNS server where given a URL the server sends back an IP address

  9. Program, which creates a three thread. One thread display the numbers from 1 to 5, second thread display the square root of that number etc

  10. An applet program to display Vertical Color Bar

  11. Program of insertion sort

  12. Develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side, executed on server

  13. Corba program of Count Client Applet, IDL,Server, Client

  14. An applet program to draw Polygon Graph with given data

  15. Develop a CORBA application that takes a string from client and returns whether it is palindrome

  16. An applet program to draw concentric circle in center of the canvas

  17. Program to show an example of using constructors in a class to initialize its data members

  18. Program to extract a portion of a character string and print the extracted string

  19. Program of UDP datagram

  20. Program to show the use of Increment and Decrement Operators

 
 
Didn't find what you were looking for? Find more on Program to find a factorial of a given number