Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Astha86 authored Feb 4, 2024
1 parent e26f34b commit 46e0284
Show file tree
Hide file tree
Showing 60 changed files with 667 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Pattern Printing/+inHollowRhombus.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter no. of lines: ";
cin>>n;
for(int i=n+1;i>1;i--){
for(int j=1;j<=2*n+1;j++){
// int a=n-i+1;
int b=j;
if(b>n+1) b=(2*n+2)-j;
if((i==b)|| (j==n+1)) cout<<"*";
else cout<<" ";
}
cout<<endl;
}

for(int i=1;i<=2*n+1;i++){
cout<<"*";
}
cout<<endl;

for(int i=2;i<=n+1;i++){
for(int j=1;j<=2*n+1;j++){
// int a=n-i+1;
int b=j;
if(b>n+1) b=(2*n+2)-j;
if((i==b)|| (j==n+1)) cout<<"*";
else cout<<" ";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/+inHollowRhombus.exe
Binary file not shown.
31 changes: 31 additions & 0 deletions Pattern Printing/HollowStarRhombus.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n: ";
cin>>n;
for(int i=n;i>=1;i--){
for(int j=1;j<2*n;j++){
int a=j;
if(a>n){
a=2*n-j;
}
if(i==a) cout<<"*";
else cout<<" ";
}
cout<<endl;
}

for(int i=2;i<=n;i++){
for(int j=1;j<2*n;j++){
int a=j;
if(a>n){
a=2*n-j;
}
if(i==a) cout<<"*";
else cout<<" ";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/HollowStarRhombus.exe
Binary file not shown.
18 changes: 18 additions & 0 deletions Pattern Printing/NumReverseV.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter no. of lines: ";
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<2*n;j++){
int a=n-i+1;
int b=j;
if(b>n) b=2*n-j;
if(a==b) cout<<i;
else cout<<" ";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/NumReverseV.exe
Binary file not shown.
49 changes: 49 additions & 0 deletions Pattern Printing/StarOutX.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n: ";
cin>>n;
int a = n+1;
for(int i=1;i<n;i++){
for(int j=1;j<=i;j++){
cout<<"*";
}

for(int j=1;j<=a;j++){
cout<<" ";
}
a-=2;

for(int j=1;j<=i;j++){
cout<<"*";
}

cout<<endl;
}

for(int i=1;i<=n/2;i++){
for(int j=1;j<2*n;j++){
cout<<"*";
}
cout<<endl;
}

int b=1;
for(int i=1;i<n;i++){
for(int j=1;j<=n-i;j++){
cout<<"*";
}

for(int j=1;j<=b;j++){
cout<<" ";
}
b+=2;

for(int j=1;j<=n-i;j++){
cout<<"*";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/StarOutX.exe
Binary file not shown.
28 changes: 28 additions & 0 deletions Pattern Printing/alphaBridge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter row: ";
cin>>n;
for(int i=1;i<2*n;i++) {
cout<<(char)('A'+i-1);
}
cout<<endl;
for(int i=1;i<n;i++){
int a=65;
for(int j=1;j<=n-i;j++){
cout<<(char)a;
a++;
}
for(int j=1;j<=2*i-1;j++){
cout<<" ";
a++;
}
for(int j=1;j<=n-i;j++){
cout<<(char)a;
a++;
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/alphaBridge.exe
Binary file not shown.
14 changes: 14 additions & 0 deletions Pattern Printing/alphasquare.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include<iostream>
using namespace std;
int main (){
int i,j,n;
cout<<"Enter the number : ";
cin>>n;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cout<<(char)(j+64)<<" ";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/alphasquare.exe
Binary file not shown.
17 changes: 17 additions & 0 deletions Pattern Printing/binaryTriangle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<iostream>
using namespace std;
int main (){
int i,j,n;
cout<<"Enter the number of rows: ";
cin>>n;
int a=1;

for(i=1;i<n+1;i++){
for(j=1;j<=i;j++){
if((i+j)%2==0) cout<<1;
else cout<<0;
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/binaryTriangle.exe
Binary file not shown.
16 changes: 16 additions & 0 deletions Pattern Printing/floydTriangle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include<iostream>
using namespace std;
int main (){
int i,j,n;
cout<<"Enter the number of rows: ";
cin>>n;
int a=1;
for(i=1;i<n+1;i++){
for(j=1;j<=i;j++){
cout<<a<<" ";
a+=1;
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/floydTriangle.exe
Binary file not shown.
24 changes: 24 additions & 0 deletions Pattern Printing/numAlphaTri.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n: ";
cin>>n;
for(int i=1;i<=n;i++){
if(i%2==1){
for(int j=1;j<=i;j++){
cout<<j<<" ";
}
}

else{
int a=65;
for(int j=1;j<=i;j++){
cout<<(char)a<<" ";
a++;
}
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numAlphaTri.exe
Binary file not shown.
32 changes: 32 additions & 0 deletions Pattern Printing/numBridge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the no. of rows: ";
cin>>n;

int m = n-1;
for(int i=1;i<2*n;i++){
cout<<i;
}
cout<<endl;
for(int a=1;a<=m;a++){
int s=1;
for(int i=1;i<=m+1-a;i++){
cout<<s;
s++;
}

for(int j=1;j<2*a;j++){
cout<<" ";
s++;
}

for(int i=1;i<=m+1-a;i++){
cout<<s;
s++;
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numBridge.exe
Binary file not shown.
20 changes: 20 additions & 0 deletions Pattern Printing/numPyramidPalindrome.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<iostream>
using namespace std;
int main(){
int r;
cout<<"Enter the number of rows: ";
cin>>r;
for(int i=1;i<=r;i++){
for(int j=1;j<=r-i;j++){
cout<<" ";
}
for(int k=1;k<=i;k++){
cout<<k;
}
for(int q=i-1;q>=1;q--){
cout<<q;
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numPyramidPalindrome.exe
Binary file not shown.
31 changes: 31 additions & 0 deletions Pattern Printing/numReverseBridge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the no. of rows: ";
cin>>n;
for(int i=1;i<2*n;i++){
if(i>n){
int a=(2*n)-i;
cout<<a;
}
else cout<<i;

}
cout<<endl;
for(int a=1;a<n;a++){
for(int i=1;i<=n-a;i++){
cout<<i;
}

for(int j=1;j<2*a;j++){
cout<<" ";
}

for(int i=n-a;i>=1;i--){
cout<<i;
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numReverseBridge.exe
Binary file not shown.
19 changes: 19 additions & 0 deletions Pattern Printing/numSpiralReverse.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n: ";
cin>>n;
for(int i=1;i<2*n;i++){
for(int j=1;j<2*n;j++){
int a=i;
int b=j;
if (i>n) a=2*n-i;
if(b>n) b=2*n-j;
int x = min(a,b);
cout<<n-x+1<<" ";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numSpiralReverse.exe
Binary file not shown.
14 changes: 14 additions & 0 deletions Pattern Printing/numberSquare.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include<iostream>
using namespace std;
int main (){
int i,j,n;
cout<<"Enter the number : ";
cin>>n;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cout<<j<<" ";
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numberSquare.exe
Binary file not shown.
18 changes: 18 additions & 0 deletions Pattern Printing/numbersSpiral.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n: ";
cin>>n;
for(int i=1;i<2*n;i++){
for(int j=1;j<2*n;j++){
int a=i;
int b=j;
if(a>n) a=2*n-i;
if(b>n) b=2*n-j;
cout<<min(a,b);
}
cout<<endl;
}
return 0;
}
Binary file added Pattern Printing/numbersSpiral.exe
Binary file not shown.
Loading

0 comments on commit 46e0284

Please sign in to comment.