Alongbar Daimary answered You can Try this. class Display{ public static void main(String[]ar){ for(int I=1;I<=5;I++){ for(int j=1;j<=I;j++){ System.out.print (I); } //System.out.println(); } } }