Advertisement
YasserZ

Triangle Wave

Feb 20th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int freq, amp, t, x = 1;
  6.     cin >> t;
  7.     cout << endl;
  8.     for(int i = 1; i <= t; i++)
  9.     {
  10.         cin >> amp >> freq;
  11.         cout << endl;
  12.         x = 1;
  13.         while(x <= freq)
  14.         {
  15.  
  16.  
  17.             for(int j = 1; j <= amp; j++)
  18.             {
  19.                 for(int k = 0; k < j; k++)
  20.                     cout << j;
  21.             cout << endl;
  22.             }
  23.  
  24.             for(int m = amp - 1; m >= 0; m--)
  25.             {
  26.                 for(int k = 0; k < m; k++)
  27.                     cout << m;
  28.             cout << endl;
  29.             }
  30.             x++;
  31.         }
  32.  
  33.     }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement