Advertisement
xathrya

Alternating Triangle

Dec 11th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int i, j, N;
  6.    
  7.     cin >> N;
  8.     char c;
  9.    
  10.     for (i=N; i>0; i--) {
  11.         if (i%2)
  12.             c = '*';
  13.         else
  14.             c = '#';
  15.         for (j=0; j<i; j++)
  16.             cout << c;
  17.         cout << endl;
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement