Star Rhombus (Filled)

By Developgram - January 10, 2017

/*
Summary: Print filled rhombus pattern of stars.
*/

#include <stdio.h>

int main()
{
    int row, space, col, n;
    
    printf("Enter the number of rows: ");
    scanf("%d", &n);
    
    for(row=1;row<=n;row++)
    {
        for(space=row;space<n;space++)
            printf(" ");
        
        for(col=1;col<(row*2);col++)
                printf("*");
        printf("\n");
    }
    
    for(row=n-1;row>=1;row--)
    {
        for(space=n;space>row;space--)
                printf(" ");
                
        for(col=1;col<(row*2);col++)
                printf("*");
        printf("\n");
    }

    return 0;
} 

  • Share:

You Might Also Like

0 comments