Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class Solution {
  5.  
  6. public static void main(String[] args) {
  7. /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
  8.  
  9. Scanner in = new Scanner(System.in);
  10.  
  11. int n = in.nextInt();
  12.  
  13. String[] arr = new String[n];
  14.  
  15. for(int i=0; i<n; i++) {
  16. String str = "";
  17. for(int k=0; k<n-(i+1); k++) {
  18. str+=" ";
  19. }
  20. for(int k=0; k<i+1; k++) {
  21. str+="#";
  22. }
  23. arr[i] = str;
  24. }
  25.  
  26. for(int i=0; i<n; i++) {
  27. System.out.println(arr[i]);
  28. }
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement