forked from InnogeeksOrganization/coderspree2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5 questions of patterns completed InnogeeksOrganization#155
- Loading branch information
1 parent
5357054
commit 16ddc08
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
IOT/seriouslyanuj_AnujGupta_2125it1096_2/patterns/pattern-type-1-official.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int n = sc.nextInt(); | ||
|
||
for (int i = 1; i <= n; i++) { | ||
for (int j = 1; j <= i; j++) { | ||
System.out.print("*\t"); | ||
} | ||
System.out.println(); | ||
} | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
IOT/seriouslyanuj_AnujGupta_2125it1096_2/patterns/pattern-type-2-official.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int n = sc.nextInt(); | ||
|
||
int nstars = n; | ||
for (int i = 1; i <= n; i++) { | ||
for (int j = 1; j <= nstars; j++) { | ||
System.out.print("*\t"); | ||
} | ||
nstars--; | ||
System.out.println(); | ||
} | ||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
IOT/seriouslyanuj_AnujGupta_2125it1096_2/patterns/pattern-type-3-official.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int n = sc.nextInt(); | ||
|
||
int nspaces = n - 1; | ||
int nstars = 1; | ||
|
||
for (int i = 1; i <= n; i++) { | ||
for (int j = 1; j <= nspaces; j++) { | ||
System.out.print("\t"); | ||
} | ||
|
||
for (int j = 1; j <= nstars; j++) { | ||
System.out.print("*\t"); | ||
} | ||
|
||
nspaces--; | ||
nstars++; | ||
System.out.println(); | ||
} | ||
|
||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
IOT/seriouslyanuj_AnujGupta_2125it1096_2/patterns/pattern-type-4-official.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int n = sc.nextInt(); | ||
int spaces = 0; | ||
int stars = n; | ||
for(int i = 1; i <= n; i++){ | ||
for(int j = 1; j <= spaces; j++){ | ||
System.out.print("\t"); | ||
} | ||
for(int j = 1; j <= stars; j++){ | ||
System.out.print("*\t"); | ||
} | ||
System.out.println(); | ||
spaces++; | ||
stars--; | ||
} | ||
|
||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
IOT/seriouslyanuj_AnujGupta_2125it1096_2/patterns/pattern-type-5-official.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int n = sc.nextInt(); | ||
|
||
int nspaces = n / 2; | ||
int nstars = 1; | ||
for (int i = 1; i <= n; i++) { | ||
for (int j = 1; j <= nspaces; j++) { | ||
System.out.print("\t"); | ||
} | ||
|
||
for (int j = 1; j <= nstars; j++) { | ||
System.out.print("*\t"); | ||
} | ||
|
||
if (i <= n / 2) { | ||
nspaces--; | ||
nstars += 2; | ||
} else { | ||
nspaces++; | ||
nstars -= 2; | ||
} | ||
|
||
System.out.println(); | ||
} | ||
|
||
} | ||
} |