class Pyramid { public static void main(String[] args) { for(int i=1; i<= 5 ;i++)//to print i values of 5 rows in increasing order { for(int j=0; j < i; j++)//to print j values in 5 columns { System.out.print(j+1); } System.out.println(""); } } }
No comments:
Post a Comment