Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using namespace std;
  2.  
  3. int main()
  4. {int N,i,j,k;
  5. cin>>N;
  6. for (i = 1; i <= N; i++)
  7. {
  8. for (j = 1; j <= N - i; j++)
  9. cout << " ";
  10. cout<<"*";
  11. for ( j = 1; j <= 2*i - 2; j++)
  12. cout << " ";
  13. if (i!=1)cout<<"*";
  14. cout << endl;
  15.  
  16. }
  17. for (i = N - 1; i >= 1; i--)
  18. { for (j = 1; j <= N - i; j++)
  19. cout << " ";
  20. cout<<"*";
  21. for (j = 1; j <= 2 * i - 2; j++)
  22. cout << " ";
  23. if (i!=1)cout<<"*";
  24. cout << endl;
  25. }
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement