fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n = 6;
  6. cout << "pola1"<<endl;
  7. for(int i = 1; i <= n; i++) {
  8.  
  9. for(int j = 1; j <= i; j++) {
  10. cout << " ";
  11. }
  12. for (int k = 1; k <= i; k++){
  13. cout << "*";
  14. }
  15. cout << endl;
  16. }
  17.  
  18. cout << "pola2"<<endl;
  19. for (int i=n; i>1; i--){
  20. for (int j=1; j<i; j++){
  21. cout << '*';
  22. }
  23. cout << endl;
  24. }
  25.  
  26.  
  27. cout << "pola3"<<endl;
  28. for (int i=1; i<=n; i++){
  29. for (int j=i; j<n; j++){
  30. cout << ' ';
  31. }
  32. for (int s=1; s<=2*i-1; s++){
  33. cout << '*';
  34. }
  35. cout << endl;
  36.  
  37. }
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5300KB
stdin
45
stdout
pola1
 *
  **
   ***
    ****
     *****
      ******
pola2
*****
****
***
**
*
pola3
     *
    ***
   *****
  *******
 *********
***********