Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class StopNumber {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter your first number: ");
- int N = Integer.parseInt(sc.nextLine());
- System.out.print("Enter your second number: ");
- int M = Integer.parseInt(sc.nextLine());
- System.out.print("Enter your stop number: ");
- int S = Integer.parseInt(sc.nextLine());
- for (int i = M; i >= N; i--) {
- if (i % 2 == 0 && i % 3 == 0) {
- if (i == S) {
- break;
- }
- System.out.print(i + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement