Int main (void)
{
Int n, even=0, odd=0;
Float sumeven=0, sumodd=0;
While (1)
{
The scanf (" % d ", & amp; N);
{if (n==0) break; }
If (n % 2==0)
{
Sumeven +=n;
Even++;
}
The else
{
Sumodd +=n;
Odd++;
}
break;
}
Printf (" the Number of even: % d; Business of even: % 2 f \ n ", even, sumeven/even);
Printf (" the Number of odd: % d; Business of odd: % 2 f \ n ", odd, sumodd/odd);
return 0;
}
Why the output is not normal



CodePudding user response:
# include
Int main (void)
{
Int n, even=0, odd=0;
Float sumeven=0, sumodd=0;
While (1)
{
The scanf (" % d ", & amp; N);
If (n==0) {
break;
}
If (n % 2==0)
{
Sumeven +=n;
Even++;
}
The else
{
Sumodd +=n;
Odd++;
}
//break;
}
Printf (" the Number of even: % d; Business of even: % 2 f \ n ", even, sumeven/even);
Printf (" the Number of odd: % d; Business of odd: % 2 f \ n ", odd, sumodd/odd);
return 0;
}
For your reference ~
More than a break;
CodePudding user response:
Under your circulation inside the break, the excess can lead to circulation only performs to exit, to remove it