-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ5.java
More file actions
23 lines (21 loc) · 679 Bytes
/
Copy pathJ5.java
File metadata and controls
23 lines (21 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
> Date Created: 23/04/2026
> Author: Ishaan Rastogi
> Purpose: To print an inverted right equilateral triangle pattern
> Operating System: This is only for Windows OS, it may or may not work on other OS
> Program Status: 100% Working
*/
import java.util.Scanner;
class J5 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the length of the right equilateral triangle: ");
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i + 1; j++) {
System.out.print("* ");
}
System.out.println();
}
}
}