题解 | #n的阶乘#
n的阶乘
https://www.nowcoder.com/practice/97be22ee50b14cccad2787998ca628c8
#include <stdio.h> int main() { int n; long ans; ans=1; scanf("%d",&n); for(int i=1;i<=n;i++){ ans=ans*i; } printf("%ld\n",ans); }
n的阶乘
https://www.nowcoder.com/practice/97be22ee50b14cccad2787998ca628c8
#include <stdio.h> int main() { int n; long ans; ans=1; scanf("%d",&n); for(int i=1;i<=n;i++){ ans=ans*i; } printf("%ld\n",ans); }
相关推荐