Learn about Square Pattern Program with Alphabets in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Square Pattern Program with Alphabets in C
Pattern:
A A A A A B B B B B C C C C C D D D D D E E E E E
Program:
#include<stdio.h>
int main()
{
int n;
printf("Enter number of rows: ");
scanf("%d",&n);
for(int r=1; r<=n; r++)
{
for(int c=1; c<=n; c++)
{
printf("%3c",r+64);
}
printf("\n");
}
return 0;
}
Output:
Enter number of rows: 5 A A A A A B B B B B C C C C C D D D D D E E E E E
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Pattern Program 4 in C
Pattern Program 3 in C