Nisheeth

The Di-Triangle

Jul 1st, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     int j,k,b;
  8.     k = 2;
  9.     int a = 0;
  10.     b = 18;
  11.     int y = 1;
  12.     for (int i = 10; i > 0; i -= 1)
  13.     {
  14.         int x = 1;
  15.         j = 0;
  16.         while (j<k)
  17.         {
  18.             cout << "*";
  19.            
  20.             a = 0;
  21.             if (x == y)
  22.             {
  23.                 while (a < b)
  24.                 {
  25.                     cout << " ";
  26.                     a++;
  27.                 }
  28.             b -= 2;
  29.             }
  30.             j++;
  31.             x++;
  32.         }
  33.         k += 2;
  34.         y++;
  35.         cout <<  endl;
  36.     }
  37.  
  38.     ;
  39.     cin.get();
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment