Advertisement
Guest User

Untitled

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