C Program to print Hollow Rhombus in a star pattern Type 1
Program
#include <stdio.h>
void main()
{
int i, j, k, n;
printf("Enter the number of rows to print the hollow rhombus\n");
scanf("%d", &n);
for(i = 1; i <= n; i++)
{
for(j = 1; j<= (n + 1) - i; j++)
{
printf("*");
}
for(k = 1; k < i; k++)
{
printf(" ");
}
for(j = 1; j <= (n + 1) - i; j++)
{
printf("*");
}
printf("\n");
}
for(i = 2; i <= n; i++)
{
for(j = 1; j <= i; j++)
{
printf("*");
}
for(k = 1; k <= n - i; k++)
{
printf(" ");
}
for(j = 1; j <= i; j++)
{
printf("*");
}
printf("\n");
}
}
Output
Enter the number of rows to print the rhombus
5
**********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
**********