1130: 零起点学算法37——求阶乘
Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 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 }
查看更多关于1130: 零起点学算法37——求阶乘的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did238276