Home > Back-end >  For help!
For help!

Time:10-03

Your program to read in a series of positive integer data, end of said input, input - 1-1 itself is not the input data, read the program output data of the odd and even number,



Input format:

A series of positive integers, the range of integer (0100 000), indicates if the input - 1 input end,



The output format:

Two integers, the first integer is read in odd number of data, the second integer is read in data of the even number of two integers separated by Spaces between


Why I not line!! Small white for help!


# include & lt; Stdio. H>
Int main ()
{
Int x;
int n;
Int count1=0;
Int count2=0;
//the scanf (" % d ", & amp; x);
Do {
The scanf (" % d \ n "enter a positive integer, & amp; x);
N=x % 2;
The switch (n) {
Case 1:
Count1=count1 + 1;
Printf (" % d ", x);
break;
Case 0:
Count2=count2 + 1;
Printf (" % d ", x);
break; }
}
While (x>=0);

Printf (" the number of odd number is % d, even for % d \ n ", count1, count2);
return 0;
}
  • Related