Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int i, j;
  8.  
  9. for(i=1; i<=5; i++)
  10. {
  11. for(j=5; j>i; j--)
  12. {
  13. cout<<" ";
  14. }
  15. cout<<"*";
  16. for(j=1; j<(i-1)*2; j++)
  17. {
  18. cout<<" ";
  19. }
  20. if(i==1) cout<<"\n";
  21. else cout<<"*\n";
  22. }
  23.  
  24. for(i=4; i>=1; i--)
  25. {
  26. for(j=5; j>i; j--)
  27. {
  28. cout<<" ";
  29. }
  30. cout<<"*";
  31. for(j=1; j<(i-1)*2; j++)
  32. {
  33. cout<<" ";
  34. }
  35. if(i==1) cout<<"\n";
  36. else cout<<"*\n";
  37. }
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement