View difference between Paste ID: sJi8LuPW and pUNvzVdL
SHOW: | | - or go back to the newest paste.
1
package lecture4;
2
3
import java.util.Scanner;
4
5
public class NumbersInLine {
6
    public static void main(String[] args) {
7
        Scanner scanner = new Scanner(System.in);
8
9
        System.out.print("Введите первое число: ");
10
        int x = scanner.nextInt();
11
        System.out.print("Введите последнее число: ");
12
        int y = scanner.nextInt();
13
        System.out.print("Введите количество чисел в строке: ");
14
        int n = scanner.nextInt();
15
16
        int counter = 0;
17-
        int x1=x;
17+
18
        while (counter <= y-x) {
19-
        while (x1 <= y) {
19+
            System.out.printf("%3d ", x+counter);
20-
            System.out.printf("%3d ", x1);
20+
21
22
            if (counter % n == 0) {
23
24
                System.out.println();
25
            }
26
        }
27-
            x1++;
27+
28
}