C Program to print Number rhombus , Creating rhombus shape in C, rhombus Shape in C

C Program to print Number rhombus , Creating rhombus shape in C, rhombus Shape in C





#include
#include
int main()
{
 int num,r,c,sp;
 printf("Enter number of rows : ");
 scanf("%d",&num);
 for(r=1; r<=num; r++)
 {
   for(sp=num-r; sp>0; sp--)
       printf(" ");
   for(c=r; c>=1; c--)
       printf("%d",c);
   for(c=2; c<=r; c++)
       printf("%d",c);
   printf("\n");
 }
 for(r=1; r<=num; r++)
 {
   for(sp=r; sp>=1; sp--)
       printf(" ");
   for(c=num-r; c>=1; c--)
       printf("%d",c);
   for(c=2; c<=num-r; c++)
       printf("%d",c);
   printf("\n");
 }
 getch();
 return 0;
}

No comments:

Post a Comment