Advertisement
16112

6.5 Стопиращо число

Dec 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. package kursova_rabota;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class shest_pet {
  6.  
  7.     public static void main(String[] args) {
  8.         // TODO Auto-generated method stub
  9.         Scanner sc = new Scanner(System.in);
  10.         int end = Integer.parseInt(sc.nextLine());
  11.         int start = Integer.parseInt(sc.nextLine());
  12.         int stopNumber = Integer.parseInt(sc.nextLine());
  13.  
  14.         for (int i = start; i >= end; i--) {
  15.             if (i % 2 == 0 && i % 3 == 0 && i != stopNumber) {
  16.                 System.out.printf(i + " ");
  17.             } else if (i % 2 == 0 && i % 3 == 0 && i == stopNumber) {
  18.                 break;
  19.             }
  20.         }
  21.         System.out.println();
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement