Advertisement
desislava_topuzakova

03. Numbers 1...N with Step 3

Jan 29th, 2022
920
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Numbers1toNOver3_03 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.         //ОТПЕЧАТВАМ ЧИСЛА ОТ 1 ДО N ПРЕЗ 3
  8.         //повтаряме: печатаме число
  9.         //начало: 1
  10.         //край: n
  11.         //промяна: +3
  12.         for (int number = 1; number <= n; number += 3) {
  13.             System.out.println(number);
  14.         }
  15.     }
  16. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement