Factorial De Un Numero En C++
Hallar el factorial de n numero
#include<iostream>
using namespace std;
int main()
{
long double n,cant,fact;
fact=1;
cout<<"ingrese el numero"<<endl;
cout<<endl;
cin>>n;
cant=n;
cout<<endl;
while (n>0)
{
fact=fact*n;
n=n-1;
}
cout<<endl;
cout<<cant<<"!="<<fact<<endl;
cout<<endl;
system ("pause");
return 0;
}
Publicidad