The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

Hollow Rhombus Star Pattern In C

In most of the MNC interview questions such as in ZOHO interview questions, IVTL Infoview interview questions, Amazon interview questions, GOOGLE interview questions, Infosys interview questions and even in Voonik interview questions, we come across star pattern questions with a probability of 1:5. We provide you a most commonly asked hollow rhombus star pattern question for your interview preparation using C programming.

Lets code a C program to print hollow rhombus star pattern to have some fun

Hollow Rhombus Star Pattern

We challenge you, the programmer to do the hollow rhombus star pattern using C programming

Hollow Rhombus Star Pattern in C
hollow-rhombus-star-pattern.c
#include <stdio.h>
int main()
{
int i, j, k, num, n;
printf("\nEnter a number: ");
scanf("%d",&num);
printf("\n");
n = num;
for(i = 0; i < num; i++)
{
for(k = n; k > 0 ; k--)
{
printf(" ");
}n--;
for(j = 0; j < num; j++)
{
if(i == 0 || i == num - 1)
{
printf("*");
continue;
}
if(j == 0 || j == num - 1)
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
Enter a number: 5
    *****
   *   *
  *   *
 *   *
*****

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report