Untitled
unknown
plain_text
4 years ago
413 B
7
Indexable
//Calcular el producto de los primeros N números enteros (también es N!, N factorial).
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int cant = 0, N = 0;
float prod = 1;
cout << "Ingrese N: ";
cin >> N;
while (cant < N)
{
cant = cant + 1;
prod = prod * cant;
}
cout << "La Suma es: " << prod << endl;
return 0;
}
Editor is loading...