Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Ronnie Mccoy   on Jan 14 In Java Category.

  
Question Answered By: Raul Clark   on Jan 14

Try the following pice of code:

public class Tester {

public static boolean isOdd(int number){
if (number % 2 == 0)
return false;
return true;
}

public static void main(String[] args) {
for (int i = 0; i < 100;i++)
{
if (isOdd(i))
System.out.println (i + ": Odd");
else
System.out.println (i + ": Even");
}
}
}

Share: