Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by James McKee ( 14 years ago )
/*
From Chris Peters In class notes
There is a error in his logic of one of the else statements, I will let you fix it.
Write your Method header (signature), SOP statement, and end the method.
Since this was on the board for everyone to copy you do not have to give credit to anyone in your assignment.
Enjoy
James
*/
int zeros = 0;
int odds = 0;
int evens = 0;
while(num != 0)
{
int digit = num % 10;
if(digit == 0)
{
zeros++;
}
else if (digit % 2) == 0
{
evens++;
}
else
odds++;
num = num/10;
}
SOPln("Odds - " + odds ETC....);
Revise this Paste
Parent: 48523