public class JavaPyramid4 {
public static void main(String[] args) {
for(int i=1; i<= 5 ;i++){
for(int j=0; j < i; j++){
System.out.print(j+1);
}
System.out.println("");
}
}
}
Output of the above program would be
*
**
***
****
*****
public static void main(String[] args) {
for(int i=1; i<= 5 ;i++){
for(int j=0; j < i; j++){
System.out.print(j+1);
}
System.out.println("");
}
}
}
Output of the above program would be
*
**
***
****
*****
No comments:
Post a Comment