+ 2

Write a program to print the following pattern?

* * * * * * * * *

4th Mar 2019, 2:16 PM
Sailakshmi Janjanam
4 Respuestas
+ 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
5th Mar 2019, 12:22 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 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.
4th Mar 2019, 2:22 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
System.out.println("*\n**\n***\n**\*);
4th Mar 2019, 3:08 PM
Anwar
Anwar - avatar
+ 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(""); }
3rd Jun 2019, 10:56 AM
Sailakshmi Janjanam