Advertisement
desislava_topuzakova

02. Numbers N...1

Jan 29th, 2022
838
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class NumbersNto1_02 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.         //отпечатаме всички числа от n до 1
  8.         //повтаряме: печатане на числото
  9.         //начало: n
  10.         //крайна: 1
  11.         //промяна: -1
  12.  
  13.         for (int number = n; number >= 1; number--) {
  14.             System.out.println(number);
  15.         }
  16.     }
  17. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement