Skip to content

Instantly share code, notes, and snippets.

@jesuscmadrigal
Created September 15, 2017 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesuscmadrigal/2466048b4a0ec5ec0dd459fb9b86a13b to your computer and use it in GitHub Desktop.
Save jesuscmadrigal/2466048b4a0ec5ec0dd459fb9b86a13b to your computer and use it in GitHub Desktop.
Factorial
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main ()
{
int X, Y;
double long A;
string another;
do
{
cout<< "Ingresa un numero." << endl;
cin>> X;
int xD=X;
A=X;
while (X!=1)
{
X=X-1;
A=A*X;
} cout<< ""<<xD<<"! es: "<<A<<" " << endl;
cout<< "¿Quieres probar otro numero?" << endl;
cin>> another;
transform(another.begin(), another.end(), another.begin(), ::tolower);
} while(another=="Si" or another=="si" );
cout<< "Gracias por usar el programa :)" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment