码迷,mamicode.com
首页 > 其他好文 > 详细

n阶多项式递归

时间:2015-01-09 20:42:03      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

#include <stdio.h>
float p(int n,float x)
{
if(n==0)
return (1);
else if(n==1)
return (x);
else
return (((2*n-1)*x-p((n-1),x)-(n-1)*p((n-2),x))/n);

}
int main()
{
float x;
int n;
printf("please input n x:");
scanf("%d%f",&n,&x);
printf("%f",p(n,x));
return 0;

}

n阶多项式递归

标签:

原文地址:http://www.cnblogs.com/SSYYGAM/p/4214017.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!