[C_MM21-易] 算階乘
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- long long factorial = 1;
- while(cin >> n)
- {
- if(0 < n && n < 20)
- {
- for(int i = 1; i <= n; i++)
- {
- factorial = factorial * i;
- }
- cout << factorial << endl;
- factorial = 1;
- }
- }
- return 0;
- }
沒有留言:
張貼留言