answersLogoWhite

0

public class StarPyramid

{

public static void main(String [] args)

{

int space = 0, line = 0, star = 0;

for(line = 1; line <= 26; line ++)

{

for(space = 26; space > line; space--)

{

System.out.print(" "); // Display one space

}

for(star = 1; star < line; star++)

{

System.out.print("*‟);

}

for(star = line; star >= 1; star--)

{

System.out.print("*‟);

}

System.out.println(); // Display new line with ln

}

}

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Write a c program to print the following pyramid 1 121 1231 12321 1234321?

To print the given pyramid pattern in C, you can use nested loops. The outer loop controls the rows, and the inner loop controls the numbers to be printed in each row. Here's a simple C program to achieve this: #include &lt;stdio.h&gt; int main() { int rows = 5; for (int i = 1; i &lt;= rows; i++) { for (int j = 1; j &lt;= i; j++) { printf(&quot;%d&quot;, j); } for (int j = i - 1; j &gt;= 1; j--) { printf(&quot;%d&quot;, j); } printf(&quot;\n&quot;); } return 0; } This program will output the desired pyramid pattern.


Write a program to print an astrick in 1st line 2 astricks in 2nd line and so on 25 astricks in 25th line?

With a nested loop this is fairly simple. Example, in Java: for (int i = 1; i


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?


Write a program to Print pyramid of numbers using java?

hi question is here, 1 1 2 1 2 3 1 2 3 4


Write a unix program to print print a pattern?

echo 'print a pattern'


Write an assembly language program to print a to z on screen?

write a program to print A to Z on screen in c?


Which is a program embedded in firmware that manages print jobs?

Print Server


How can one print out Christmas cards?

To print out Christmas card is simple. You need cardstock and a printer attached to your computer. You can create cards of your own with a Word or card program you may have installed on your computer or go to a website such as Ecards.


How do you print a booklet?

print it how you normally would and then staple it together.. simple


How do you print from compaq laptop?

Use the option File / Print in the program you are using.


How do you print the answer you get?

Select the answer, copy and paste into a word processing program, and print as you would print any other document.


How to print a jet airways ticket?

If your screen does not give you an option to Print then save the document to a word program and print from there.