当前位置:网站首页>请用递归的方法计算下列函数的值:px(x,n)=x-x^2 +x^3- x^4+… ((-1)n-1)(xn) n>0 **输入格式要求:“%lf%d“ 提示信息:“Enter X and N:”
请用递归的方法计算下列函数的值:px(x,n)=x-x^2 +x^3- x^4+… ((-1)n-1)(xn) n>0 **输入格式要求:“%lf%d“ 提示信息:“Enter X and N:”
2022-06-12 04:16:00 【Kilmil】
#include <stdio.h>
#include <math.h>
int m = 0, n1 = 0;
int px(double x, int n, int *s);
int main(void) {
double x = 0;
int n = 0, s = 0;
printf("Enter X and N:");
scanf("%lf%d", &x, &n);
n1 = n - 1;
px(x, n, &s);
printf("%d", s);
return 0;
}
int px(double x, int n, int *p) {
if (m <= n1) {
*p += px(x, ++m, p);
}
return pow(-1, n - 1) * pow(x, (double)n);
}
边栏推荐
- Kotlin协程协程作用域,CoroutineScope MainScope GlobalScope viewModelScope lifecycleScope 分别代表什么
- (idea)the file size(2.85M) exceeds configured limit(2.56M). Code insight features are not available
- [fpga+fft] design and implementation of FFT frequency meter based on FPGA
- JSP实现银柜台业务绩效考核系统
- How to have peace of mind? Get a new heart
- 疫情数据分析平台工作报告【8.5】额外的爬虫和绘图
- 疫情数据分析平台工作报告【3】网站部署
- SQL Safe Backup显示器和缩放字体的支持
- SQL safe backup display and zoom font support
- Experience the good team collaborative development process brought by Huawei cloud code hosting from 0 [my Huawei cloud experience journey] [play with Huawei cloud]
猜你喜欢

Brief introduction to 44 official cases of vrtk3.3 (combined with steamvr)

【C语言】程序的内存四区模型

eBPF系列学习(4)了解libbpf、CO-RE (Compile Once – Run Everywhe) | 使用go开发ebpf程序(云原生利器cilium ebpf )

Unity脚本出现missing时的解决方法

Enterprise Architect v16

Mongodb essence summary

Image mosaic based on transformation matrix

SQL Safe Backup显示器和缩放字体的支持

图解 Apache SkyWalking UI 的使用

Paper recommendation: relicv2, can the new self supervised learning surpass supervised learning on RESNET?
随机推荐
[FPGA chaos] implementation of FPGA based chaotic system Verilog
Network tester operation manual renix rack management
hash function
Experience the good team collaborative development process brought by Huawei cloud code hosting from 0 [my Huawei cloud experience journey] [play with Huawei cloud]
Message queuing overview
Is it safe for Guojin Securities Commission Jinbao to open an account? How should we choose securities companies?
Evolution and practice of Unicom real-time computing platform
Goodbye to excel and PPT, I found a better visual fool software
MySQL的check约束数字问题
Mysql主从搭建与Django实现读写分离
根據變換矩陣進行圖像拼接
E-commerce middle office system architecture
LINQ group by and select series - LINQ group by and select collection
Encapsulation manuelle d'un foreach et d'une carte
R语言plotly可视化:plotly可视化分组(grouped)小提琴图(grouped violin plot in R with plotly)
Webpack--- optimization_ cache
webpack---优化_缓存
基于SSH实现健身俱乐部管理系统
JSP implementation of bank counter business performance evaluation system
[mysql][mysql 8.0 compressed package installation method]