kidroca

Increasing row sequence

Nov 27th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner console = new Scanner(System.in);
  10.  
  11.         int rowsAndCols = Integer.parseInt(console.nextLine());
  12.         int currentNumber = rowsAndCols - 1;
  13.  
  14.         for (int row = 1; row <= rowsAndCols; row++) {
  15.  
  16.             for (int col = 1; col <= rowsAndCols; col++) {
  17.                 System.out.print(currentNumber);
  18.             }
  19.  
  20.             currentNumber += 2;
  21.             System.out.println();
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment