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?

Continue Learning about Engineering

What is the code of a program that construct a program that displays a pyramid on the screen?

Here's a simple Python program that constructs and displays a pyramid: def print_pyramid(height): for i in range(height): print(' ' * (height - i - 1) + '*' * (2 * i + 1)) print_pyramid(5) This code defines a function print_pyramid that takes the height of the pyramid as an argument and prints a pyramid made of asterisks (*). Adjust the height parameter in the print_pyramid function call to change the size of the pyramid.


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 unix program to print print a pattern?

echo 'print a pattern'


Write a program to print the series 072663124--term n?

To print the series 072663124 for a given term n, you can use a simple program in Python. The series appears to follow a specific pattern, so you can create a function that generates and prints the series up to the nth term. Here’s a basic implementation: def print_series(n): series = &quot;072663124&quot; print(series[:n]) # Example usage: n = 9 # specify the term you want to print print_series(n) This program prints the first n characters of the series. Adjust n to get the desired output.


Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.

Related Questions

What is the code of a program that construct a program that displays a pyramid on the screen?

Here's a simple Python program that constructs and displays a pyramid: def print_pyramid(height): for i in range(height): print(' ' * (height - i - 1) + '*' * (2 * i + 1)) print_pyramid(5) This code defines a function print_pyramid that takes the height of the pyramid as an argument and prints a pyramid made of asterisks (*). Adjust the height parameter in the print_pyramid function call to change the size of the pyramid.


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 qbasic program to display A NEW LINE?

In QBasic, you can display a new line using the PRINT statement. To create a new line, you can simply use an empty PRINT statement. Here’s a simple example: PRINT &quot;This is the first line.&quot; PRINT ' This will create a new line. PRINT &quot;This is the third line.&quot; This program will display the first line, then move to a new line, followed by the third line.


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?


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.


Program to print wvwn numbers from 1 to 100 in gw basic?

In GW-BASIC, you can print even numbers from 1 to 100 using a simple loop. Here’s a sample code: FOR i = 1 TO 100 IF i MOD 2 = 0 THEN PRINT i NEXT i This program iterates through numbers 1 to 100 and prints each number if it is even (i.e., divisible by 2).


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

Print Server


How do you print a booklet?

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