First Off . . . Im not looking for anyone to write the code for me. That being said I need some pointers on what I'm doing wrong with my program.
Program Description: Should have a "while" loop that asks repeatedly for a number until a number divisible by 3 or 7 is given. When that occurs, your program should display the number of numbers read.
Here is what I have thus far :
There is something misplaced or left out. . . Im new to programming and haven't figured out to get what's in my head translated to the computer.Quote:
import java.util.Scanner;
public class DivisibleBy3or7
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("This program reads numbers until one is divisible by 3 or 7");
System.out.println("Write a Number: ");
int Number = input.nextInt();
int i = 1;
int sum = 0;
while (( Number % 3 != 0 ) && ( Number % 7 != 0 ))
{
sum = sum + 1
System.out.println("Write a Number; ");
i++;
}
System.out.println("There were " + sum + " numbers read ");
}
}
Thanks,
Dan

