mirror of
https://github.com/System-End/APCSA.git
synced 2026-04-19 16:38:24 +00:00
23 lines
579 B
Java
23 lines
579 B
Java
/* Lesson 3 Coding Activity Question 4 */
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class U4_L3_Activity_Four {
|
|
|
|
public static void main(String[] args) {
|
|
Scanner scanner = new Scanner(System.in);
|
|
|
|
System.out.println("Enter a positive integer:");
|
|
int num = scanner.nextInt();
|
|
|
|
if (num <= 0) {
|
|
System.out.println("error");
|
|
} else {
|
|
int start = num - (num % 3);
|
|
for (int i = start; i >= 0; i -= 3) {
|
|
System.out.print(i + " ");
|
|
}
|
|
System.out.println();
|
|
}
|
|
}
|
|
}
|