answersLogoWhite

0


Best Answer

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

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

class star

{

public static void main(String args[])

{

int i,j;

for(i=1;i<6;i++)

{

for(j=1;j<=i;j++)

System.out.print("*");

System.out.println();

}

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

import java.util.Scanner;

/*

* Some this is reverse type of Pyramids

* Engr Sajjad Hussain Panhwar

* Contact me (engr.sajad83@gmail.com)

* Mobile No:+923023271032

*/

class test{

public static void main(String arg[]){

System.out.print("Enter a number");

Scanner in=new Scanner(System.in);

int n=in.nextInt();

for(int i=n; i>0; i--){

for(int j=n-i; j>0; j--) //this is for space

System.out.print(" ");

for(int k=(i-1); k>0; k--)//this is for stars

System.out.print(" *");

System.out.println();// new line

}}

}

*****************************output******************************

Enter a number 8

* * * * * * * * *

* * * * * * * *

* * * * * * *

* * * * * *

* * * * *

* * * *

* * *

* *

*

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

public class Test {

public static void main(String[] args) {

System.out.println("*");

}

}

The above program will print one "*" symbol in the console

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write simple java program to print equlater star pyramid?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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

123454321


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

Here is a simple Python program to print asterisks as described: for i in range(1, 26): print('*' * i) This will output asterisks from 1 to 25 as required.


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?


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.


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


How do you print from compaq laptop?

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


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.


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.