1 1 * 1 * 3 1 * 3 * 1 * 3 * 5
Answer :
package pattren;
public class Pattern2 {
public static void main(String[] args) {
for(int i=1;i<6;i++){
for(int j=1;j<=i;j++){
if(j%2==0)
System.out.print(" * ");// Every even column will print *
else
System.out.print(j+" ");
}
System.out.println();
}
}
}
No comments:
Post a Comment