Advertisement
ZhilinskiyG

Task 2_12

Mar 12th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int z = 1, s, n, c = 0, q, n1;
  8.  
  9.     cin>> n;
  10.     n1 = n;
  11.     s = n - 1;
  12.  
  13.     while (n > 0)
  14.     {
  15.  
  16.         for (int i = 0; i < s; i++)
  17.             cout << " ";
  18.  
  19.         for (int j = 0; j < z; j++)
  20.             cout << "*";
  21.  
  22.         cout << endl;
  23.  
  24.         z += 2;
  25.         s--;
  26.         n--;
  27.     }
  28.     q = n1 - 1;
  29.     z = 2 * n1 - 3;
  30.     s = 1;
  31.  
  32.     while (q>0)
  33.     {
  34.         for (int w = 0; w<s; w++)
  35.             cout << " ";
  36.         for (int e = 0; e<z; e++)
  37.             cout << "*";
  38.  
  39.         cout << endl;
  40.         z -= 2;
  41.         s++;
  42.         q--;
  43.     }
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement