IlanZiin

script 05 cpp

Aug 18th, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <locale>
  4.  
  5. using namespace std;
  6. int setup();
  7.  
  8. int main()
  9. {
  10.     setup();
  11.     int num, resultado = 1;
  12.     cout << "Digite um numero para fatorar:\n-> ";
  13.     cin >> num;
  14.  
  15.     for(int i = 1; i < num; i++)
  16.         resultado = resultado * (i + 1);
  17.  
  18.     cout << resultado << endl;
  19.     system("pause");
  20.     return 0;
  21. }
  22.  
  23. int setup()
  24. {
  25.     setlocale(LC_ALL, "");
  26.     system("color f9");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment