Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86b52e0
commit 55508d6
Showing
9 changed files
with
327 additions
and
0 deletions.
There are no files selected for viewing
Submodule dailycodebase
added at
86b52e
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,25 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern1 { | ||
public static void main(String []args) | ||
{ | ||
int i,j; | ||
for(i=1;i<=5;i++) | ||
{ | ||
for(j=1;j<=i;j++) | ||
{ | ||
System.out.print(j); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} |
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 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern2 { | ||
public static void main(String []args) | ||
{ | ||
int i,j;int k=1; | ||
for(i=1;i<=4;i++) | ||
{ | ||
for(j=1;j<=i;j++) | ||
{ | ||
System.out.print(k); | ||
k++; | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
|
||
} |
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,31 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern3 { | ||
public static void main(String []args) | ||
{ | ||
int i,j;int k=0; | ||
int t=5/2; | ||
t++; | ||
for(i=1;i<=5;i++) | ||
{ | ||
if(i<=t) | ||
k++; | ||
else | ||
k--; | ||
for(j=1;j<=k;j++) | ||
{ | ||
System.out.print(j); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} |
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,44 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern4 { | ||
public static void print(int s,int p) | ||
{ | ||
int i,j;int t; | ||
if(p<=5) | ||
{ | ||
for(i=1;i<=s;i++) | ||
System.out.print(' '); | ||
t=p; | ||
for(j=1;j<=p;j++) | ||
{ | ||
System.out.print(t); | ||
t++; | ||
} | ||
t-=2; | ||
for(j=1;j<p;j++) | ||
{ | ||
System.out.print(t); | ||
t--; | ||
} | ||
System.out.println(); | ||
s--; | ||
p++; | ||
print(s,p); | ||
} | ||
else | ||
return; | ||
} | ||
public static void main(String []args) | ||
{ | ||
print(4,1); | ||
} | ||
} |
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,30 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern5 { | ||
public static void main(String []args) | ||
{ | ||
int n=4; | ||
int i,j;int k=0;int p=(n*2-1); | ||
for(int t=1;t<=n;t++) | ||
{ | ||
for(j=1;j<=k;j++) | ||
System.out.print(' '); | ||
k++; | ||
for(i=1;i<=p;i++) | ||
{ | ||
System.out.print('*'); | ||
} | ||
p-=2; | ||
System.out.println(); | ||
} | ||
} | ||
} |
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,57 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern6 { | ||
static int n=3; | ||
public static void print(int k,int i) | ||
{ | ||
int j; | ||
for(j=1;j<=k;j++) | ||
System.out.print(' '); | ||
for(j=1;j<=i;j++) | ||
System.out.print('*'); | ||
//System.out.println(); | ||
} | ||
public static void printdown(int k,int i) | ||
{ | ||
int j; | ||
for(j=1;j<=k;j++) | ||
System.out.print(' '); | ||
for(j=1;j<=i;j++) | ||
System.out.print('*'); | ||
//System.out.println(); | ||
} | ||
public static void printrow(int i) | ||
{ | ||
int k;int j; | ||
k=n-i; | ||
while(i<=n) | ||
{ | ||
print(k,i); | ||
k--; | ||
i+=2; | ||
System.out.println(); | ||
} | ||
//k++; | ||
while(i>=1) | ||
{ | ||
printdown(k,i); | ||
k++; | ||
i-=2; | ||
System.out.println(); | ||
} | ||
} | ||
public static void main(String []args) | ||
{ | ||
printrow(1); | ||
} | ||
|
||
} |
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,56 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern7 { | ||
public static void main(String []args) | ||
{ | ||
int n=3; | ||
int i,j,t,k;int l=1; | ||
t=n*2+1; | ||
for(i=n;i>=1;i--) | ||
{ | ||
k=t-2*i; | ||
for(j=i;j>=1;j--) | ||
{ | ||
System.out.print('*'); | ||
} | ||
l=1; | ||
while(l<=k) | ||
{ | ||
System.out.print(' '); | ||
l++; | ||
} | ||
//System.out.print(' '); | ||
for(j=1;j<=i;j++) | ||
System.out.print('*'); | ||
System.out.println(); | ||
} | ||
|
||
for(i=1;i<=n;i++) | ||
{ | ||
k=t-2*i; | ||
for(j=i;j>=1;j--) | ||
{ | ||
System.out.print('*'); | ||
} | ||
l=1; | ||
while(l<=k) | ||
{ | ||
System.out.print(' '); | ||
l++; | ||
} | ||
for(j=1;j<=i;j++) | ||
System.out.print('*'); | ||
System.out.println(); | ||
} | ||
} | ||
|
||
} |
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,56 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package patterns; | ||
|
||
/** | ||
* | ||
* @author SPREEHA DUTTA | ||
*/ | ||
public class pattern8 { | ||
public static void main(String []args) | ||
{ | ||
int n=3; | ||
int i,j,t,k;int l=1; | ||
t=n*2; | ||
for(i=1;i<=n;i++) | ||
{ | ||
k=t-2*i; | ||
for(j=i;j>=1;j--) | ||
{ | ||
System.out.print('*'); | ||
} | ||
l=1; | ||
while(l<=k) | ||
{ | ||
System.out.print(' '); | ||
l++; | ||
} | ||
for(j=1;j<=i;j++) | ||
System.out.print('*'); | ||
System.out.println(); | ||
} | ||
|
||
for(i=n;i>=1;i--) | ||
{ | ||
k=t-2*i; | ||
for(j=i;j>=1;j--) | ||
{ | ||
System.out.print('*'); | ||
} | ||
l=1; | ||
while(l<=k) | ||
{ | ||
System.out.print(' '); | ||
l++; | ||
} | ||
//System.out.print(' '); | ||
for(j=1;j<=i;j++) | ||
System.out.print('*'); | ||
System.out.println(); | ||
} | ||
|
||
} | ||
} |