print a pattern program in C for
A * B * C
* D * E
* F *
G *
Answers
Answered by
2
Program:
#include <stdio.h>
int main()
{
int i, j, k = 1, count = 1;
for (i = 1; i <= 4; i++)
{
for (j = 1; j <= 5 - i + 1; j++)
{
if (count % 2 == 0)
{
printf("* ");
count++;
continue;
}
printf("%c ", (char)(k + 64));
k++;
count++;
}
printf("\n");
}
return 0;
}
output:
A * B * C
* D * E
* F *
G *
SS of the program:
Attachments:
Similar questions