Create a 2-dimensional (3 x 3) integer array which
contains 9 random numbers ranged from 0 to 100. For each number,
determine whether the number is a prime number or not. You should define
a method to test whether a number is prime or not. A prime number (n)
meets the following requirements:
- n must be larger than 1.
- If
n is greater than 1, then start dividing by 2, 3, …, n-1 and check the
remainder. If none of remainder equals to 0, then n is a prime number.
Otherwise, it is not.
Your programme should:
- Print all elements in 3 rows
- Print the total number of prime numbers.
- Print all location(s) of prime number(s) and their values (if there is any).
Sample Screen Output:
Row 1: 5 / 81 / 45
Row 2: 21 / 27 / 17
Row 3: 31 / 77 / 41
Total Number of Prime Number: 4
Row 1 and Column 1: 5
Row 2 and Column 3: 17
Row 3 and Column 1: 31
Row 3 and Column 3: 41