borkins

14. Number Table

Apr 12th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. /**
  2.  * Project: Advanced_Loops - created by borkins on 2017-04-09.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _14_NumberTable
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.        
  13.         int n = Integer.parseInt(console.nextLine());
  14.    
  15.         for (int i = 1, j; i <= n; i++)
  16.         {
  17.             for (j = i; j < n; j++) {
  18.                 System.out.printf("%d ", j);
  19.             }
  20.            
  21.             for (int k = 1; k < i; k++, j--) {
  22.                 System.out.printf("%d ", j);
  23.             }
  24.             System.out.println(j);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment