Okay, so I am taking an intro class for java programming and my instructions for this program were to write a program that found the first 20 numbers that when divided by 2,3,4,5,6 all left a reminder of one and then when divided by 7, left a reminder of 0. The first number of the 20 is 301. Now I have to write a program that finds the next 19.
I believe I have the solution, but I know there is something keeping my while loop from running. Any insight would be phenonmenal! I have been staring at this for a few days now and I cannot seem to put my finger on while the while loop will not do anything.
Thank you very much!!
import java.io.*;
public class third_program
{public static void main(String[] args) throws IOException
{
int numberSuccess=0
int number=0;
System.out.println ("This program is going to find the first 20 numbers which, when divided by 2,3,4,5,6 leave a remainder of 1and evenly divide by 7. ");
System.out.println ();
while (numberSuccess < 20 );
{
number=0;
if (number%2==1 && number%3==1 && number%4==1 && number%5==1 && number%6==1 && number%7==0)
{System.out.print(number);
numberSuccess++; number++;}
else number++;
}
System.out.print("The successful numbers are " +number);
}
}