- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram14_PatternA.java
More file actions
Latest commit
27 lines (25 loc) · 764 Bytes
/
Copy pathProgram14_PatternA.java
File metadata and controls
27 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
Write a program in Java to make such a pattern like a right angle triangle with a number which repeats a number in a row.
The pattern is as follows :
1
22
333
4444
*/
// Date : 28/12/2023, Author : Yash Wadhvani
importjava.util.Scanner;
publicclassProgram14_PatternA {
publicstaticvoidmain(String[] args) {
try (Scannersc = newScanner(System.in)) {
System.out.println("Enter No. of Rows for the Triangle :-");
intn = sc.nextInt();
System.out.print("\n");
for (inti = 1; i <= n; i++) {
for (intj = 1; j <= i; j++) {
System.out.print(i + " ");
}
System.out.print("\n");
}
}
}
}