SHARE
TWEET

Untitled

a guest Feb 24th, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.*;
  4.  
  5. public class test {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int n = scanner.nextInt();
  10.         int count=0;
  11.  
  12.         for (int i = 1; i < n; i++) {
  13.             for (int j = 1; j <= n; j++) {
  14.                 System.out.print(i + " ");
  15.                 count++;
  16.                 if (i == j||count>=n) {
  17.                     break;
  18.                 }
  19.  
  20.             }
  21.             if (count>=n) {
  22.                 break;
  23.             }
  24.         }
  25.     }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top