Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int fatorial(int a)
- {
- if (a <= 1)
- {
- return 1;
- }
- return a * fatorial(a - 1);
- }
- int main()
- {
- int a;
- cout << "Informe o nΓΊmero:" << endl;
- cin >> a;
- cout << fatorial(a) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement