Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Main {
- public static void main(String[] args) {
- Random rnd = new Random();
- int evenNumbers = 0;
- int oddNumbers = 0;
- for (int i = 0; i < 100; i++)
- {
- int x = rnd.nextInt(100) + 1;
- isEven(x);
- }
- }
- public static boolean isEven(int number)
- {
- if ((number % 2) == 0 )
- {
- System.out.println(number + " is even");
- return true;
- }
- else
- {
- System.out.println(number + " is odd");
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment