+ 2
Write a program to print the following pattern?
* * * * * * * * *
4 Answers
+ 16
â see number of rows needed(k), number of maximum stars a row can have((k+1)/2) & the pattern of number of stars followed in each row.
//give it a try & post your code for getting much better help from community, good luck
+ 8
int n;
for (int i = 0;i<=4;i++){
n = 3 - (Math.abs(2-i));
for (int j = 0;j<n;j++){
System.out.print("* ");
}
System.out.println("");
}
Put this in the main method.
+ 4
System.out.println("*\n**\n***\n**\*);
+ 1
int n;
for (int i = 0;i<=4;i++){
n = 3 - (Math.abs(2-i));
for (int j = 0;j<n;j++){
System.out.print("* ");
}
System.out.println("");
}