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. Program to show the use of some Character Methods

  2. Program to print some text on the same line using multiple print statements

  3. Program of UDP datagram

  4. Program to copy the elements of an array into another array in reverse order and print them

  5. Do the following for the Array Insert the element in the array,delete an element from the array,search for a particular element Create multiple thread

  6. Program to show an example of searching Strings for characters

  7. CORBA program for displaying the date and time of the server machine, client machine and the difference between these two date and time

  8. Program to append a StringBuffer by StringBuffer, String objects and other Basic Data Types

  9. Biological Sequence Allignment Using Dynamic Programing

  10. Program that accepts a shopping list of five items from the command line and stores them in vector

  11. Program to declare and initialize Integer variables and print them on the Standard Output Device

  12. An applet program to display alternate filled and empty circle that to in row and column format

  13. Corba program to develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side

  14. Corba program of date operations

  15. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  16. 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

  17. Program to show an example of creating a class and using its object

  18. An applet program showing Clicked Event on canvas

  19. Write a program for restaurant

  20. Create an interface coversions. Which have the following functions Inchestomillimeters(), hptowatts(),wattstohp(),poundstogram(),gramtopounds()

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