the format of the pyramid should be like this:
1
123
12345
1234567
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package printpyramid;
/**
*
* @author Sunshine
*/
public class PrintPyramid {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int n=8;
for(int i=1;i<n;i=i+2){
for(int j=1;j<i+1;j++){
// System.out.println("");
System.out.println(j);
}
System.out.println(" ");
}
}
}
1
123
12345
1234567
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package printpyramid;
/**
*
* @author Sunshine
*/
public class PrintPyramid {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int n=8;
for(int i=1;i<n;i=i+2){
for(int j=1;j<i+1;j++){
// System.out.println("");
System.out.println(j);
}
System.out.println(" ");
}
}
}