Factorial number is multiply the own back number Like if number is 5 then =5*4*3*2*1 =120
/*Program to find factorial of a number*/
Output:
/*Program to find factorial of a number*/
#include<iostream.h>
#include<conio.h>
void main()
{
int j,n,fact=1;
clrscr();
cout<<"\n
enter the number: ";
cin>>n;
for(j=1;j<=n;j++)
fact=fact*j;
cout<<"factorial
of"<<n<<"="<<fact;
getch();
}
0 comments:
Post a Comment