Computer Science, asked by TashuGupta14, 4 months ago

solve this using java loop program..​

Attachments:

Answers

Answered by anindyaadhikari13
2

Answer:-

➡ This is the required program for your question given below.

import java.util.*;

class Pattern

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the number of rows for the pattern: ");

int n=sc.nextInt();

System.out.println("Here is your pattern.... ");

int space=1;

for(int i=n;i>=1;i--)

{

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

System.out.print("*");

for(int x=1;x<space;x++)

System.out.print(" ");

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

System.out.print("*");

System.out.println();

space+=2;

}

}

}

Similar questions