Advertisement
ykzolov

2e

Jun 26th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a, i = 0, s, l = 1, l_n;
  8.     cout << "enter a number: ";
  9.     cin >> a;
  10.     while (i < a) {
  11.         i++;
  12.         s = a - i;
  13.         while (s > 0) {
  14.             cout << " ";
  15.             s--;
  16.         }
  17.         l_n = l;
  18.         while (l_n > 0) {
  19.             cout << "*";
  20.             l_n--;
  21.         }
  22.         l = l + 2;
  23.         cout << endl;
  24.     }
  25.     s = a - 1;
  26.     while (s > 0) {
  27.         cout << " ";
  28.         s--;
  29.     }
  30.     cout << "*";
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement