C++ Programs & Stuffz

Nothing like anything!!!

Please Click on ADS!!

Please Click on the above ads given by GOOGLE , so that I can maintain my blog!!

Tuesday, August 31, 2010

Print the factorial of a number

//pgm to print the factorial of a number
#include<iostream.h>
#include<conio.h>
void main()
{
    int i,n,f;
    clrscr();
    cout<<"enter the value of n"<<endl;
    cin>>n;
    f=1;
    for(i=1;i<=n;i++)
    {
        f=f*i;
    }
    cout<<f;
    getch();
}

0 comments:

Post a Comment

free counters