-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPattern.java
48 lines (42 loc) · 891 Bytes
/
Pattern.java
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
int rows;
Scanner s=new Scanner(System.in);
rows=s.nextInt();
for (int i = 1; i <= rows; ++i) {
for (int j = 1; j <= i; ++j) {
System.out.print("* ");
}
System.out.println();
}
}
}
//Program to print Pattern
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
....etc
/*
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
int rows, k = 0;
Scanner s=new Scanner(System.in);
rows=s.nextInt();
for (int i = 1; i <= rows; ++i, k = 0) {
for (int space = 1; space <= rows - i; ++space) {
System.out.print(" ");
}
while (k != 2 * i - 1) {
System.out.print("* ");
++k;
}
System.out.println();
}
}
}*/