Home > Back-end >  Just learn c, wrote a statistical number of positive and negative zero program, namely hangzhou elec
Just learn c, wrote a statistical number of positive and negative zero program, namely hangzhou elec

Time:10-02

RT, program the following
#include
Int main ()
{
Int a=0;
Int x, y, z, j;
int n;
While (the scanf (" % d ", & amp; A)!=(EOF)
{

X=0;
Y=0;
Z=0;
J=0;
While (a -)
{
The scanf (" % d ", n);
If (n<0)
{
X++;
}
Else if (n==0)
{
Y++;
}
The else
{
Z++;
};
J=1;
};
If (j) printf (" % d % d % d ", x, y, z);
};
return 0;
}
Error when debugging the program received signal sigsegv, eliminate later found the problem on the if else statements that a, could you tell me what is the problem?
With devc++
  • Related