C Program to Print Rhombus Star Pattern

Write a C Program to Print Rhombus Star Pattern using for loop. The main loop in this example iterates from the last row to the first, and nested for loops prints the rhombus pattern.

#include<stdio.h>
int main()
{
    int i, j, k, rows;
    printf("Enter Rhombus Star Pattern Rows =  ");
    scanf("%d", &rows);

    printf("Rhombus Star Pattern\n");
    for(i = rows; i >= 1; i--)
    {
        for(j = 1; j <= i - 1; j++)
        {
            printf(" ");
        }
        for(k = 1; k <= rows; k++)
        {
            printf("*");
        }         
        printf("\n");   
    }
    return 0;
}
C Program to Print Rhombus Star Pattern 1

This C Program allows entering a symbol and printing that symbol in Rhombus Pattern.

#include<stdio.h>
int main()
{
    int i, j, k, rows;
    char ch;
    
    printf("Symbol for Rhombus Pattern =  ");
    scanf("%c", &ch);

    printf("Enter Rhombus Star Pattern Rows =  ");
    scanf("%d", &rows);

    printf("\n");
    i = rows;
    while(i >= 1)
    {
        j = 1;
        while(j <= i - 1)
        {
            printf(" ");
            j++;
        }
        k = 1;
        while(k <= rows)
        {
            printf("%c", ch);
            k++;
        }         
        printf("\n"); 
        i--;  
    }
    return 0;
}
Symbol for Rhombus Pattern =  #
Enter Rhombus Star Pattern Rows =  9

        #########
       #########
      #########
     #########
    #########
   #########
  #########
 #########
#########

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.