-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParallelogram_Pattern.java
More file actions
37 lines (34 loc) · 871 Bytes
/
Parallelogram_Pattern.java
File metadata and controls
37 lines (34 loc) · 871 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
28
29
30
31
32
33
34
35
36
37
// Parallelogram Pattern
// Send Feedback
// Write a program to print parallelogram pattern for the given N number of rows.
// For N = 4
// The dots represent spaces.
// Input Format :
// A single integer : N
// Output Format :
// Required Pattern
// Constraints :
// 0 <= N <= 50
// Sample Input 1 :
// 3
// Sample Output 1 :
// ***
// ***
// ***
import java.util.Scanner;
public class Parallelogram_Pattern {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
for (int row = 1; row <= n; row++) {
for (int space = 1; space <= row - 1; space++) {
System.out.print(" ");
}
for (int star = 1; star <= n; star++) {
System.out.print("*");
}
System.out.println();
}
s.close();
}
}