We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b406c87 commit fcd4fe6Copy full SHA for fcd4fe6
InterviewPrograms/src/com/java/patterns/Pattern43.java
@@ -0,0 +1,36 @@
1
+package com.java.patterns;
2
+import java.util.Scanner;
3
+/*
4
+Write the program to print the following pattern
5
+* * * * *
6
+* * * *
7
+* * *
8
+* *
9
+*
10
+*/
11
+public class Pattern43 {
12
+ public static void main(String args[] ) throws Exception {
13
+ Scanner scanner = new Scanner(System.in);
14
+ int N = Integer.parseInt(scanner.nextLine());
15
+ for(int i=0;i<N;i++){
16
+ for(int j=0;j<N-i;j++)
17
+ if(j == 0)
18
+ System.out.print("*");
19
+ else
20
+ System.out.print(" *");
21
+ if(i != N-1)
22
+ System.out.println();
23
+ }
24
+ scanner.close();
25
26
+}
27
28
+Input
29
+5
30
+Output
31
32
33
34
35
36
0 commit comments