Program to find Factorial of number


    #include <iostream.h>
    void main()
    {
        int i , number , factorial ;
        cout<<"Enter a number :\n";
        cin>>number;

        for (i=1,factorial=1 ; i<=number ; i++)
            factorial = factorial * i ;

     cout<<"The factorial of "<<number<<" : "<<factorial;
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|