Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions java loops/pattern.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.util.Scanner;
public class pattern
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

System.out.println("Enter the number of rows: "); //takes input from user

int rows = sc.nextInt();

for (int i= rows-1; i>=0 ; i--)
{
for (int j=0; j<=i; j++)
{
System.out.print("*" + " ");
}
System.out.println();
}
sc.close();
}
}