int main()
{
printf("请输入一个数:");
int a[5],b = 0,c = 0;
while ( b < 5 ) {
scanf("%d",&a[b]);
if ( a[b] < 0 )
c = c + 1;
b = b + 1;
}
printf("负数有:%d个",b);
return 0;
}
int main()
{
printf("请输入一个数:");
int a[5],b = 0,c = 0;
while ( b < 5 ) {
scanf("%d",&a[b]);
if ( a[b] < 0 )
c = c + 1;
b = b + 1;
}
printf("负数有:%d个",c);
return 0;
}
int main()
{
printf("请输入一个数:");
int a[5],b = 0,c = 0;
do {
scanf("%d",&a[b]);
if ( a[b] < 0 )
c = c + 1;
b = b + 1;
}while ( b < 5 );
printf("负数有:%d个",c);
return 0;
}