想问一下这个程序错哪了?

[复制链接]
查看11 | 回复0 | 2010-12-8 14:23:23 | 显示全部楼层 |阅读模式
#include
#include
int sjx(int x,int y)
{

int z;

if (y==1||y==x)

return 1;

else

{

z=sjx(x-1,y-1)+sjx(x-1,y);

}

return z;
}
int main(void)
{

int i,j,n;

printf("input n= ");

scanf("%d",&n);

for (i=1;ij=0时进入函数int sjx(int x,int y),会调用 z=sjx(x-1,y-1)+sjx(x-1,y);
导致出现负数参数的情况,出现太多递归调
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行