注册 登录
编程论坛 Matlab

这个程序为什么会无限循环??

wandison 发布于 2006-11-07 12:22, 688 次点击
这个程序为什么会无限循环??
#include<stdio.h>
main()
{
int i, n;
printf("input the n=");
scanf("%d",&n);

while(i<=n){
printf(" * ");
printf("\n");
i++;
}
return 0;
}
谢谢!!
4 回复
#2
海蓝啸2006-11-07 13:08
i的值是多少?
#3
machizhou2006-11-07 14:32
i没有给初始值
#4
wandison2006-11-08 09:19
i=1也没用啊!
#5
abingchem2006-11-08 09:23
怎么会呢?
初始化:i=1,n=10试试
1