C语言实验——求阶乘(循环结构) (sdut oj)
来源:互联网 发布:pcb开料软件 编辑:程序博客网 时间:2024/05/18 15:06
C语言实验——求阶乘(循环结构)
Time Limit: 3000MS Memory Limit: 65536KB
Problem Description
从键盘输入任意一个大于等于0的整数n,然后计算n的阶乘,并把它输出。
提示: 0!是 1 。
Input
输入任意一个大于等于0的整数n。
Output
输出n!
Example Input
3
Example Output
6
Hint
Author
参考代码
#include <stdio.h>int main(){ int i; int n; int sum = 1; scanf("%d",&n); for(i = 1; i <= n; i++) { sum *= i; } printf("%d",sum); return 0;}
0 0
- C语言实验——求阶乘(循环结构) (sdut oj)
- oj 1956: C语言实验——求阶乘(循环结构)
- C语言实验——求阶乘(循环结构)
- C语言实验——求阶乘(循环结构)
- C语言实验——求阶乘(循环结构)
- C语言实验——for循环打印图形(循环结构)(sdut oj)
- C语言实验——判断素数(循环结构)(sdut oj)
- C语言实验——计算1到n的和(循环结构)(sdut oj)
- C语言实验——求绝对值(选择结构)(sdut oj)
- Problem H: C语言实验——求阶乘(循环结构)
- C语言实验——从大到小输出a、b、c(选择结构)(sdut oj)
- C语言实验——计算A+B(顺序结构)(sdut oj)
- C语言实验——交换两个整数的值(顺序结构)(sdut oj)
- C语言实验——单个字符输入和输出(顺序结构)(sdut oj)
- C语言实验——转换字母(顺序结构)(sdut oj)
- sdut-1117 C语言实验——求绝对值(选择结构)
- C语言实验——求两个整数之和 (sdut oj)
- C语言实验——求两个整数之中较大者 (sdut oj)
- POJ 1077 Eight (正向BFS + 康托展开)
- 1020. Tree Traversals (25)
- Android手机系统开发中的AP和BP是什么
- 单一职责原则(Single Responsibility Principle ,SRP)
- task-DelayQueue-订单超时实例(task任务,DelayQueue阻塞队列)
- C语言实验——求阶乘(循环结构) (sdut oj)
- spark和zeppelin实践一:安装hadoop篇
- Android 注解
- AI 互联网就要到来
- Angular入门04: 指令
- Listener、Filter、Servlet 初始化
- spring boot data rest 3
- Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class
- 用Python写一个简单的爬虫功能