/*
Summary: Print rhombus pattern of stars.
*/
#include<stdio.h>
int main()
{
int row, col, n;
printf("Enter the number of rows: ");
scanf("%d", &n);
for(row=1; row<=n; row++)
{
for(col=n; col>row; col--)
printf(" ");
printf("*");
for(col=1; col<(row-1)*2; col++)
printf(" ");
if(row==1)
printf("\n");
else
printf("*\n");
}
for(row=n-1; row>=1; row--)
{
for(col=n; col>row; col--)
printf(" ");
printf("*");
for(col=1; col<(row-1)*2; col++)
printf(" ");
if(row==1)
printf("\n");
else
printf("*\n");
}
return 0;
}
0 comments