Java Lab: Output Range With Increment of 10

preview_player
Показать описание
----------------------------------------------------------------------------------------
Social media:
----------------------------------------------------------------------------------------

Code in comments
Рекомендации по теме
Комментарии
Автор

import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);

int num1 = scnr.nextInt();
int num2 = scnr.nextInt();

if (num2 < num1) {
System.out.println("Second integer can't be less than the first.");
}

else if (num2 == num1) {
System.out.println(num1 + " ");
}

else {
while (num1 <= (num2)) {
System.out.print(num1 + " ");
num1 += 10;
}

System.out.println();
}
}
}

collegehelper