Advertisement
Sinux1

PS5Q9 cs 111

Mar 11th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int height;
  7.  
  8.     cout << "Enter a height\n";
  9.     cin >> height;
  10.  
  11.  
  12.     if (height < 1)
  13.     {
  14.         cout << "Height must be at least one.\n";
  15.         return 0;
  16.     }
  17.     for (int row = 1; row <=height; row++)
  18.     {
  19.         for (int col = 1; col <=row; col++)
  20.         {
  21.             cout << "*";
  22.         }
  23.         cout << endl;
  24.     }
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement