【HUSTOJ】1021: 数字之积

来源:互联网 发布:网络作家富豪榜2015年 编辑:程序博客网 时间:2024/05/17 07:01

1021: 数字之积

Time Limit: 1 Sec  Memory Limit:128 MB
Submit: 133  Solved: 118

原题链接

Description

求1*2*3*...*n

Input

输入一行,只有一个整数n(1<=n<=10)

Output

输出只有一行(这意味着末尾有一个回车符号),包括1个整数。

Sample Input

5

Sample Output

120

HINT

Source

#include<iostream>using namespace std;int main(){int n,fa=1;cin>>n; while(n){fa*=n--;}cout<<fa<<endl;return 0; } 


0 0
原创粉丝点击