Advertisement
asdfg0998

Untitled

Jan 19th, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. cout<<"enter the n: ";
  7. cin>>n;
  8. int up=(n+1)/2;
  9. for(int i=up;i>=1;i--)
  10. {
  11. int spaces=2*(up-i);
  12. for(int j=1;j<=spaces;j++)
  13. {
  14. cout<<" ";
  15. }
  16. int chars=2*(i-1)+1;
  17. for(int k=1;k<=chars;k++)
  18. {
  19. cout<<"* ";
  20. }
  21. cout<<endl;
  22. }
  23. for(int i=2;i<=up;i++)
  24. {
  25. int spaces=2*(up-i);
  26. for(int j=1;j<=spaces;j++)
  27. {
  28. cout<<" ";
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement