技术栈

(C语言)计算n的阶乘

柯宇!?2023-12-05 14:41

要求使用双精度

cpp 复制代码
#include<stdio.h>
double factorial(int n)
{
	if(n == 1)
		return 1;
	return n * factorial(n-1);
}
int main()
{
	int n ;
	double res;
	scanf("%d",&n);
	res = factorial(n);
	printf("%lf",res); 
	return 0;
}

运行截图:

注:侵权可删

上一篇:SpringSecurity,defaultSuccessUrl不跳转指定页面
下一篇:【AIGCode】让AI生成随机数据
相关推荐
荒川之神
5 分钟前
拉链表概念与基本设计
java·开发语言·数据库
workflower
15 分钟前
用硬件换时间”与“用算法降成本”之间的博弈
人工智能·算法·安全·集成测试·无人机·ai编程
chushiyunen
15 分钟前
python中的@Property和@Setter
java·开发语言·python
爱编码的小八嘎
20 分钟前
C语言完美演绎6-17
c语言
小樱花的樱花
22 分钟前
C++ new和delete用法详解
linux·开发语言·c++
froginwe11
23 分钟前
C 运算符
开发语言
fengfuyao985
1 小时前
低数据极限下模型预测控制的非线性动力学的稀疏识别 MATLAB实现
开发语言·matlab
摇滚侠
1 小时前
搭建前端开发环境 安装 nodejs 设置淘宝镜像 最简化最标准版本 不使用 NVM NVM 高版本无法安装低版本 nodejs
java·开发语言·node.js
t19875128
1 小时前
MATLAB十字路口车辆通行情况模拟系统
开发语言·matlab
热门推荐
01GitHub 镜像站点022026年3月AI领域大事件:DeepSeek引领开源风暴03Qwen3.5-Omni与Qwen3.6模型全面解析(含测评/案例/使用教程)04Claude Code + GLM4.7 避坑指南:解决 Unable to connect to Anthropic services05AI 编程效率翻倍:Superpowers Skills 上手清单 + 完整指南06让 Trae IDE 智能体 “读懂”文档 Excel+PDF+DOCX :mcp-documents-reader 工具使用指南07UV安装并设置国内源08Mac 本地部署 OMLX + 通义千问 Qwen3.5-27B 保姆级教程09“wsl --install -d Ubuntu-22.04”下载慢,中国地区离线安装 Ubuntu 22.04 WSL方法(亲测2025年5月6日)10深扒 Claude Code Buddy 模式:一只仙人掌背后的确定性随机算法