josecarlosgutierrez2002@gmail.com

 avatar
Jose20025
c_cpp
3 years ago
373 B
8
Indexable
#include <iostream>

using namespace std;

int FAC(int n);

int main() {

  int numero;

  system("cls");
  cout << "Digite el numero: ";
  cin >> numero;

  cout << "\nEl resultado es: " << FAC(numero) << endl;

  return 0;
}

int FAC(int n) {
  int factorial = 1;

  for (int i = 1; i <= n; i++) {
    factorial *= i;
  }

  return factorial;
}
Editor is loading...