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