Write a C++ program to find the factorial of a given number
#include<iostream.h>
#include<conio.h>
void main( )
{
int n,fact,i;
clrscr();
cout<<"Enter the number"<<endl;
cin>>n;
fact=1;
for(i=1;i<=n;i++)
fact=fact*i;
cout<<n<<"!="<<fact;
getch( );
}

No comments: