please help me with this problem thank you!. ..you may leave some comments for m
ID: 3618282 • Letter: P
Question
please help me with this problem thank you!. ..you may leave some comments for me to understand thank you. 1. An integer is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime, but 4, 6, 8 and 9 are not. a) Write a method that determines whether a number is prime. b) Use this method in an application that determines and displays all the prime numbers less than 10,000. How many numbers up to 10,000 do you have to test to ensure that you have found all the primes? c) Initially, you might think that n/2 is the upper limit for which you must test to see whether a number is prime, but you need only go as high as the square root of n. Why? Rewrite the program, and run it both ways.Explanation / Answer
please rate - thanks import java.util.*; public class isPrime{ public static void main(String[] args) {int number,i=0; System.out.println("The prime numbers between 1 and 10000are:"); for(number=2;numberRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.