提交时间:2024-08-20 21:58:46

运行 ID: 173599

#include <iostream> using namespace std; int factorial(int n) { int result = 1; for (int i = 2; i <= n; i++) { result *= i; } return result; } int main() { int n; cin >> n; cout << n << "!=" << factorial(n) << endl; return 0; }