Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Triangle {
- static void staircase(int n) {
- int j = 0;
- for (int i = n; i >= 1; i--) {
- for (j = 1; j <= i; j++) {
- System.out.print(" ");
- }
- for (int k = j; k <= n; k++) {
- System.out.print("#");
- }
- System.out.println();
- }
- }
- static Scanner scanner = new Scanner(System.in);
- public static void main(String[] args) {
- int n = scanner.nextInt();
- scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
- staircase(n);
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement