Cs practicals.

Write a program to display the following pattern
A
Ba
Cba
Dcba
#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = i; j >= 0; j--) cout << char('A' + j);
        cout << endl;
    }
    return 0;
}





Comments

Post a Comment