This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 输入一个整数,输出它的阶乘。
// 例如:输入5,输出120
#include <iostream>
using namespace std;
int main()
{
int n;
int sum = 1;
cout << "请输入一个整数:";
cin >> n;
while (n)
sum *= n;
--n;
}
cout << sum << endl;
return 0;