How to write a program in java to display given certain pattern?
1
12
123
1234
12345
class Example5{
public static void main(String args[]){
for(int i=1;i<6;i++){
System.out.println();
for(int j=1; j<=i; j++){
System.out.print(j);
}
}
}
}
1
12
123
1234
12345
class Example5{
public static void main(String args[]){
for(int i=1;i<6;i++){
System.out.println();
for(int j=1; j<=i; j++){
System.out.print(j);
}
}
}
}
No comments:
Post a Comment