Write a program to print all the prime numbers between 1 and 20 using any looping control
structure.
Answers
Answered by
4
int number = 1;
int primeNumberCount = 0;
boolean check = true;
while(check)
{
int numOfFactors=0;
/* //This loop finds the number of factors for a given number. It will only check for factors which are equal or less than half the value of the number. For each factor found, the number of factors value will be incremented. */
for (int j=1; j <=(number/2) ; j++)
{ if( (number%j) == 0)
numOfFactors++;
Please Drop Me Some❤❤❤ For My All Answers Please My Dear Friend
Similar questions