Advertisement
sheredega

task 17

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