Hollow rhombus pattern in c and java language.

■》Code link -> click πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡

https://www.programiz.com/online-compiler/5fkgXGPFEy758

■ Program->

#include<stdio.h>

#include<conio.h>

void main()

{

    int n;

    clrscr();

    printf("enter no. of rows=");

    scanf("%d",&n);

    for(int i=1; i<=n; i++)

    {

      for(int j=n-i; j>=1; j--)

     {

       printf(" ");

     }

     for(int j=1; j<=n; j++)

     {

     if(i==1 || i==n || j==1 || j==n)

         printf("*");

     else

        printf(" ");

     }

     printf("\n");

   }

   getch();

}

■》 Output->

enter no. of rows=4

    * * * *

  *        *

 *       *

* * * *

   


Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.