Print Stars Pyramid Program in java
The following program shows how to write a program to print stars pyramid in java
print stars pyramid program in java,write a java program to print stars,write a java program to print pyramid,write a program to print stars pyramid,printing stars program.
class Pyramid
{
public static void main(String[] args)
{
int x=11;
int y=x/2; // spaces
int z=1; // *`s
{
public static void main(String[] args)
{
int x=11;
int y=x/2; // spaces
int z=1; // *`s
for(int i=0;i<5;i++)
{
for(int j=0;j<y;j++)
{
System.out.print(" ");
}
for(int k=0;k<z;k++)
{
System.out.print("*");
}
y=y-1;
z=z+2;
System.out.println(); //new line
}
}
}
we need more program
ReplyDeletethis is smart work no need to write more program for this
Deleteno u r ri8 swati its need more programme to make self smart...
Deletecan u give a little explaination about it aswell please ..?
ReplyDeleteThis comment has been removed by the author.
ReplyDelete// Simplest Way //
ReplyDeletepublic class Star6 {
public static void main(String[] args)throws IOException {
int x,i,j,k;
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Enter Rows"); x=Integer.parseInt(br.readLine());
for(i=1;i<=x;i++){
for(k=x;k>=i;k--){
System.out.print(" ");
}
for(j=0;j<(i*2)-1;j++){
System.out.print("*");
}System.out.println();
}
}
}
hi guys yes we can write more program as a programmer can think differently and can apply own logic
ReplyDeletethanks for reply
the simplest way
ReplyDeletepublic class For {
public static void main(String[] args) {
for(int i=1;i<=9;i++)
{
System.out.println();
for(int k=9;k>=i;k--)
System.out.print(" ");
for(int j=1;j<=i;j++)
System.out.print(" *");
}}