Answer:
//declare variable and initialize to 0
int odd=0;
//declare variable and initialize to 0
int oddCount=0;
//declare variable and initialize to 0
int evenCount=0;
//declare variables and initialize to 0 and 1
int even=0, i=1;
//iterates when i is greater than 0
while (i>0)
{
// get input in the variable i from the user
i = stdin.nextInt();
//check that i divided by 0, its remainder is 0 and i is greater than 0
if ((i % 2)==0 && (i>0))
{
//then, add the variable even with i
even+=i;
//and increase the count of the even by 1
evenCount++;
}
//check that i divided by 0, its remainder is not 0 and i is greater than 0
if ((i % 2)!=0 && (i>0))
{
//then, add the variable odd with i
odd+=i;
//and increase the count of the odd by 1
oddCount++;
}
}
//then, print the following message
System.out.print(even + " " + odd + " " + evenCount + " " + oddCount);
Explanation:
The following are the description of the program.