Pattern 11: C Program to print rhombus star pattern

Spread the love

Write a C Program to print below pattern :

Note: This is one the Series of pattern programs in C.

Program:

  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i, j, k,n;
  5.     printf(“Enter the value for n : “);
  6.     scanf(“%d”,&n);
  7.  
  8.     for(i=1;i<=n;i++)
  9.     {
  10.         for(j=1;j<=(n+1)i;j++)
  11.         {
  12.             printf(“*”);
  13.         }
  14.         for(k=1;k<i;k++)
  15.         {
  16.             printf(”  “);  // two spaces
  17.         }
  18.         for(j=1;j<=(n+1)i;j++)
  19.         {
  20.             printf(“*”);
  21.         }
  22.         printf(n);
  23.     }
  24.  
  25.     for(i=2;i<=n;i++)
  26.     {
  27.         for(j=1;j<=i;j++)
  28.         {
  29.             printf(“*”);
  30.         }
  31.         for(k=1;k<=ni;k++)
  32.         {
  33.             printf(”  “);   // two spaces
  34.         }
  35.         for(j=1;j<=i;j++)
  36.         {
  37.             printf(“*”);
  38.         }
  39.         printf(n);
  40.     }
  41.  
  42.     return 0;
  43. }

Output:

Similar Star pattern programs:

More C programs:

C Tutorials with simple Examples:

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply