#include <iostream>
using namespace std;
void fact(int a)
{
int num=1;
for(int i=1;i<=a;i++)
{
num=num*i;
}
cout<<"\nThe factorial of the number "<<a<<" is = "<<num;
}
int main()
{
int num;
cout<<"Enter a number to find its Factorial ";
cin>>num;
fact(num);
return 0;
}
No comments:
Post a Comment