Advertisement
payjack

FINALTriangle

Nov 2nd, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. //nested loops=triangle!
  2. //Mrs. Kubik
  3. //Olivia Pagach
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int getInput ()
  8. {
  9.     int x;
  10.     cout << "How tall would you like the triangle to be?" << endl;
  11.     cin >> x;
  12.     return x;
  13. }
  14. int main()
  15. {
  16.     int x = getInput ();
  17.  
  18.    for (int i=1;i<=x;i++)
  19.     {
  20.         for(int j=1;j<=i;j++)
  21.             {
  22.                 cout<<"*";
  23.             }
  24.        cout<<endl;
  25.     }
  26.  return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement