C program to Print Alphabet N star pattern
C program to Print Alphabet N star pattern
Example
#include <stdio.h>
int main()
{
int a,b;
int n = 7; // height of the N (can be adjusted)
for (a = 0; a < n; a++)
{
for (b = 0; b < n; b++)
{
// Print * for the first column, last column, and diagonal
if (b == 0 || b == n - 1 || b == a)
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
No comments:
Post a Comment