Monday, 29 February 2016

Types of pyramid programs pattern 10



Program
class Main{
public static void main(String args[]){
int i,j;
for(i=1;i<=5;i++){
for(j=1;j<=i;j++)
System.out.print(""+j);
System.out.print("\n");
}
}
}

OUTPUT:-
C:\Users\saty\Desktop>javac 1.java
C:\Users\saty\Desktop>java Main
1

12

123

1234

12345

No comments:

Post a Comment