Advertisement
j33vansh

Answer 2 Looping CPP

Jun 26th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define FIO                           \
  4.     ios_base::sync_with_stdio(false); \
  5.     cin.tie(NULL);                    \
  6.     cout.tie(NULL);
  7.  
  8. int main()
  9. {
  10.     FIO;
  11.     int n;
  12.     cin >> n;
  13.     int i = 1;
  14.     while (i <= n)
  15.     {
  16.         char startChar = 'A' + n - i;
  17.         int j = 1;
  18.         while (j<=i)
  19.         {
  20.             char ch=startChar + j - 1;
  21.             cout<<ch;
  22.             j++;
  23.         }
  24.         cout << endl;
  25.         i++;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement