pattern practice in c ⌨️💻
#include <stdio.h>
//codewithsandhan
void main()
{
int a, x, y;
while (1)
{
printf("\nEnter a number : ");
scanf("%d", &a);
for (y = a; y >= -a; y--)
{
for (x = -a; x <= a; x++)
{
if (x == 0 || y == 0 || x == -y || x == y)
{
printf("%c", 64 + x);
}
else
{
printf(" ");
}
if (x == a)
{
printf("\n");
}
}
}
}
Comments
Post a Comment