Question: I want to make a program that outputs a table of all of the numbers from 100 to 1000 that are divisible by both 5

I want to make a program that outputs a table of all of the numbers from 100 to 1000 that are divisible by both 5 and 6. I want the numbers to be separated by exactly one space and to have 10 numbers per line. I'm trying to use a loop, but I can't figure out how to get both the /5 and the /6 together. Can you please explain to me how I can make this work? Here are my error messages followed by my code:

Incompatible types. Found: 'int', required: 'boolean'

Condition 'i <= 1000' is always 'true'

The value i / 6 assigned to 'i' is never used

The value changed at 'i++' is never used

Redundant call to 'printf()'

package Week05;

public class Main {

public static void main(String[] args) {

// tell user what the program does

System.out.println("This program displays a table of all of the numbers from 100 to 1000 that are divisible by both 5 and 6..");

//Uses a loop to calculate pounds per kilogram (1 kilogram = 2.2 pounds)

//Ten numbers per line and exactly one space between numbers

int i = 1000;

for (i = i / 5; i <= 1000; i ++)

for (i = i / 6; i = 100; i++)

System.out.printf(i + "" + i + "" + i + "" + i +"" + i + "" + i + "" + i + "" + i + "" + i + "");

System.out.println("Goodbye");

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!