Advertisement
Dido09

PyramidOfNumbers

Jan 22nd, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TriangleOfNumbers {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int row = 1; row <= n ; row++ ){
  10. for (int j = 0; j < row ; j++){
  11. System.out.print(row + " ");
  12. }
  13. System.out.println();
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement