Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- if(n==1) cout<<"*";
- else
- {
- for(int i=1;i<=n;i++)
- if(i==n) cout<<"*";
- else cout<<" ";
- cout<<endl;
- for(int i=2;i<=n-1;i++)
- {
- for(int j=i;j<=n-1;j++)
- cout<<" ";
- cout<<"*";
- for(int j=1;j<=2*(i-1)-1;j++) cout<<" ";
- cout<<"*";
- cout<<endl;
- }
- for(int i=1;i<=2*n;i++)
- if(i%2==1) cout<<"*";
- else cout<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement