Write a C++ program to print stars in alphabet A (uppercase) pattern using for loop.
#include<iostream> using namespace std; int main() { int i, j, k, rows; cout << "Enter Alphabet A Star Pattern Row = "; cin >> rows; cout << "Alphabet A Star Pattern\n"; for(i = 0; i < rows; i++) { for(j = 0; j <= rows/2; j++) { if((i == 0 && j != 0 && j != rows/2) || i == rows / 2 || (j == 0 || j == rows /2 ) && i != 0) { cout << "*"; } else { cout << " "; } } cout << "\n"; } return 0; }

This C++ example prints the Alphabet A pattern of a given symbol using a while loop.
#include<iostream> using namespace std; int main() { int i = 0, j, rows; char ch; cout << "Enter Row = "; cin >> rows; cout << "Enter Symbol for Alphabet A Pattern = "; cin >> ch; while(i < rows) { j = 0; while( j <= rows/2) { if((i == 0 && j != 0 && j != rows/2) || i == rows / 2 || (j == 0 || j == rows /2 ) && i != 0) { cout << ch; } else { cout << " "; } j++; } cout << "\n"; i++; } return 0; }
Enter Row = 10
Enter Symbol for Alphabet A Pattern = #
####
# #
# #
# #
# #
######
# #
# #
# #
# #