level 7
while(i<a)
{ ……
i++;
getchar();
}
试试
2014年04月01日 22点04分
3
i只是一个变量,只能控制输入\输出的次数,达不到(输入一次,输出一次)这样的循环啊
2014年04月01日 22点04分
回复 荣耀天祺 :理解错了
2014年04月02日 10点04分
level 6
楼主这样写吧
#include <stdio.h>
int main(void){
int i,a,count=0;
printf("shurushuzhi:");
scanf("%d",&a);
while(a!=0){
for(i=1;i<=a;i++){
if(i%2==0){
if(i%7==0||i%17==0){
printf("%d\t",i);
count++;
}
}
}
printf("\n");
printf("count=%d\n",count);
count = 0;
//system("pause");
//getchar();
scanf("%d",&a);
}
return 0;
}
2014年04月02日 00点04分
5
谢谢,用你的方法解决了
2014年04月02日 00点04分
level 5
while(scanf("%d",&a)!=EOF)
这个可以
2014年04月02日 11点04分
9
不行啊,EOF=-1,当输入一个字母时是没办法进行判断的,会成为死循环
2014年04月02日 16点04分
回复 荣耀天祺 :直接&&a!=一个值就行了啊
2014年04月03日 10点04分
level 6
请问,你这是在手机上进行的代码编写与编译吗???用的什么软件?
2014年04月02日 17点04分
11
电脑 vs2010
2014年04月02日 18点04分