csansoon

P3.04 P29973 Triangle

Oct 2nd, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.20 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n, i=1;
  6.     cin >> n;
  7.     if (n>0) {
  8.         while (i<=n) {
  9.             for (int j=i; j>0; j--) {
  10.                 cout << "*";}
  11.             cout << endl;
  12.             i++;
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment