Advertisement
sergAccount

Untitled

Dec 12th, 2020
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package ja9;
  7.  
  8. /**
  9.  *
  10.  * @author Administrator
  11.  */
  12. public class MyUtil {
  13.     /*
  14.     Создать класс MyUtil
  15.     В данном классе создать метод, который выводит
  16.     целые числа от x2 до x1 включительно в обратном порядке.
  17.     x1, x2 - параметры метода типа int.
  18.     Данный метод должен возвращать значение типа void.
  19.     Вызвать данный метод в методе main в классе JA9.
  20.     */
  21.     public static void printNumbersInReverse(int x1, int x2){
  22.         // for
  23.         for(int i=x2; i>=x1; i--){
  24.             //System.out.println(i); // выводим на отдельной строке
  25.             System.out.print(i); // выводим на одной строке
  26.             System.out.print(" ");
  27.         }        
  28.     }    
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement