Если завести определение переменной
int hor = 1;
внутрь цикла while то работает, но не пойму почему....
Помогите разобраться пожалуйста!
package com.javarush.task.task04.task0434;
/*
Таблица умножения
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
int n = 1;
int hor = 1;
while (n <= 10) {
while (hor <=10) {
System.out.print(n * hor);
System.out.print(" ");
hor++;
}
if (n == 10)
break;
System.out.println();
n++;
}
}
}