I'm trying to get a program that displays all the numbers from 10 to 800 , 10 per line, that's divisible by 5 and 6 and having the numbers seperated by one space.
Can someone tell me exactly what my for loops are really doing? When i run each loop alone, one iterates from 10 to 800 downward in a column and the other just goes in a row from 1 to 10.
however when i run them together the program is terminated. Why is it doing this?
import java.util.Scanner; public class a1 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); for (int i = 10; i <= 800; i++) { for (int j = 1; j <= 10; j++) { if (i % 5 == 0 && i % 6 == 0) { System.out.print(i + " "); } } System.out.println(); } } }