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:
1.n must be larger than 1..
2.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:
1.Print all elements in 3 rows.
2.Print the total number of prime numbers..
3.Print all location(s) of prime number(s) and their values (if there is any).
1
Expert's answer
2012-11-26T06:51:39-0500
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.
Comments
Leave a comment