For Advertisements on this blog Contact Us at developgram@gmail.com or +91-9923438816

Simple Programming Tutorials For Beginners

Tuesday, January 10, 2017

Star Rhombus (Filled)

/*
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;
} 

No comments:

Post a Comment

SEARCH THIS BLOG