1130: 零起点学算法37——求阶乘


1130: 零起点学算法37——求阶乘

Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lld
Submitted: 2109  Accepted: 1328
[Submit][Status][Web Board]

Description

输入一个正整数n,计算它的阶乘

 

Input

输入一个正整数n(n<=10)(多组数据)

 

Output

输出n的阶乘(每组数据一行)

 

Sample Input

 
3

 

Sample Output

6

 

Source

 1 #include<stdio.h>
 2 int main(){
 3     int n;
 4     while(scanf("%d",&n)!=EOF){
 5          long long num=1;
 6          for(int i=n;i>0;i--){
 7              num*=i;
 8          }
 9          printf("%lld\n",num);
10     }
11     return 0;
12 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM