C program
C program to Print Alphabet J star pattern
Example
#include <stdio.h>
int main()
{
int a, b;
int height = 7;
// Height of the K
for(a = 0; a < height;a++)
{
printf("*");
// First vertical line
for(b = 0; b < height;b++) {
if (a + b == height / 2 || a - b == height / 2)
{
printf("*");
} else {
printf(" ");
}
}
printf("\n");
}
return 0;
}
No comments:
Post a Comment