Write an algorithm and a program that finds and prints all of theprime numbers b
ID: 3616699 • Letter: W
Question
Write an algorithm and a program that finds and prints all of theprime numbers between 3 and 100. A prime number is a numbersuch that one and itself are the only numbers that evenly divideit. (3,5,7,...)This is a hint from the question: One way to solve this problem is to use a double nested loop. The outer loop can iterate from 3 to 100 while the inner loopchecks to see if the counter value for the outer loop is prime. One way to see if the number n is prime is to loop from 2 ton-1 and if any of those numbers evenly divides n, then n cannot beprime. If none of the values from 2 to n-1 evenly divide n,then n must be prime. (Note that there are several easy waysto make this algorithm more efficient.)
This is a hint from the question: One way to solve this problem is to use a double nested loop. The outer loop can iterate from 3 to 100 while the inner loopchecks to see if the counter value for the outer loop is prime. One way to see if the number n is prime is to loop from 2 ton-1 and if any of those numbers evenly divides n, then n cannot beprime. If none of the values from 2 to n-1 evenly divide n,then n must be prime. (Note that there are several easy waysto make this algorithm more efficient.)