TejatPosterior @ 2019-12-11 21:00:49
#include<stdio.h>
int main ()
{int n,a[10],i,cnt=0;
for(i=0;i<10;i++)
{scanf("%d",&a[i]);}
scanf("%d",&n);
for(i=0;i<=10;i++)
if(n+30>=a[i]);
cnt++;
printf("%d",cnt);
return 0;
}
by Loxilante @ 2019-12-11 21:03:05
for(i=0;i<=10;i++)
是不是要改成
for(i=0;i<10;i++)
?
by z_y_z @ 2019-12-11 21:03:23
if(n+30>=a[i]); 不加;
by tobie @ 2019-12-11 21:03:32
@TejatPosterior
for
中的<
打成了<=
了
by Retired_yangruibin @ 2019-12-11 21:07:47
#include<stdio.h>
int main ()
{
int n,a[10],i,cnt=0;
for(i=0;i<10;i++)
{scanf("%d",&a[i]);}
scanf("%d",&n);
for(i=0;i<=10;i++)
if(n+30>=a[i]);
cnt++;
printf("%d",cnt);
return 0;
}
by TejatPosterior @ 2019-12-11 21:09:38
对不起我瞎了/哭 谢谢大家
by TejatPosterior @ 2019-12-11 21:11:26
改了还是不对啊怎么回事
by dzk从不打表 @ 2019-12-11 21:20:46
if(n+30>=a[i]); 不加分号!!!! 这个>>; ;;;;;;;
by dzk从不打表 @ 2019-12-11 21:21:33
@TejatPosterior
by TejatPosterior @ 2019-12-11 21:32:04
@dzk从不打表 !!!谢谢宁!!!
by Hevttc_Cao @ 2020-01-20 16:30:20
是不是if里条件错了 我觉得可以if ((h>=a[i])||(h+30>=a[i]))