欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C语言实验之求阶乘(循环结构)

程序员文章站 2022-07-09 14:58:13
C语言实验之求阶乘(循环结构) Time Limit:3000 msMemory Limit:65536 KiB Problem Description 从键盘输入任意一个大...

C语言实验之求阶乘(循环结构)

Time Limit:3000 msMemory Limit:65536 KiB

Problem Description

从键盘输入任意一个大于等于0的整数n,然后计算n的阶乘,并把它输出。

提示: 0!是 1 。

Input

输入任意一个大于等于0的整数n。

Output

输出n!

Sample Input

3

Sample Output

6
#include int main() { int a,sum=1,i; scanf("%d",&a); for(i = 1;i <= a;i++) { sum *= i; } printf("%d\n",sum); return 0; }