Write a program that output the following:
A
* *
B C D
* * * *
E F G H I
* * * * * *
Hint: Use nested Loops.
#include <stdio.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int main ()
{
int n = 6;
char letter = 'A';
for (int i = 0; i < n; i++) {
& for (int j = 0; j <= i; j++) {
printf("%s%c", j ? " " : "", i % 2 == 0 ? letter++ : '*');
& }
& printf("\n");
}
return 0;
}