Skip to content

Commit

Permalink
Merge pull request #3 from VivekTarun/VivekTarun-patch-3
Browse files Browse the repository at this point in the history
Create dab.cpp
  • Loading branch information
VivekTarun committed Oct 31, 2022
2 parents 77d1be6 + a92a46f commit 2a57b6d
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions dab.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <iostream>
using namespace std;

int main()
{
int n = 5;

int row = 1;

while(row<=n){
int col_1 = 1;
int col_2 = 1;

int count = 1;

while(col_1<=(n-row+1)){
cout << count << " ";
count++;
col_1++;
}


int star_1 = row-1;
while(star_1){
cout << "*" << " ";
star_1--;
}
int star_2 = row-1;
while(star_2){
cout << "*" << " ";
star_2--;
}


int count_2 = n+col_2-1;

while(col_2<=(n-row+1)){
cout << count_2 << " ";
count_2--;
col_2++;
}
cout<< endl;
row++;
}
return 0;
}

0 comments on commit 2a57b6d

Please sign in to comment.