java program to print pattern

Java Porgram to print pattern

Write a java program to prints a staircase of size  n like below show .

Java Porgram to print pattern

Java Porgram to print pattern

Input Data

An integer n , that represent the size of the staircase (pattern).

Output Data

Print a staircase (pattern) of size using # symbols and spaces using Java.


The staircase (pattern) is right-aligned, composed of # symbols and spaces, and has a height and width of n=6

import java.util.*;

public class Pattern {
    public static void main(String[] args) {
        Scanner in = new Scanner(;
        int n = in.nextInt();
       for (int k=1;k<=n;k++){
        for (int k1=1;k1<=n-k;k1++){
            System.out.printf(" ");
        for (int i=1;i<=k;i++){

The following two tabs change content below.
Umar Farooque Khan is Software developer and professional blogger serving Worldwide on freelancer and ODesk platform to show the capability of his skills. He is the founder of The main purpose of this site is sharing and exchanging of Knowledge related to the recent technologies.