//we have to print the following pattern for a given value "n"
/*
for n=3
***
* * *
** **
* * *
***
for n=5
*******
* ***** *
** *** **
*** * ***
**** ****
*** * ***
** *** **
* ***** *
*******
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int m=(2*n)-1;
for(int i=1;i<=m;i++){
for(int j=1;j<=m;j++){
if(i==j || i+j==2*n){
cout<<" ";
}
else{
cout<<"*";
}
}
cout<<"\n";
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: