C program to Print Alphabet R star pattern
Star pattern C program to Print Alphabet R
Example
#include <stdio.h>
int main()
{
int rows;
printf("Enter Rows = ");
scanf("%d", &rows);
for (int a = 0; a < rows; a++)
{
for (int b = 0; b < rows; b++)
{
if ((a == 0 || a == rows / 2) && (0 < b < rows - 1))
{
printf("*");
}
else if ((a != 0) && (b == 0 || (b == rows - 1 && a < rows / 2 )))
{
printf("*");
}
else if(b == a && a >= rows / 2)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}
Star pattern C program to Print Alphabet R
Example