Skip to content

Commit

Permalink
Merge pull request #19 from utkarshhh1/main
Browse files Browse the repository at this point in the history
diamond shaped pattern by utkarsh
  • Loading branch information
RoSPinoT authored Nov 19, 2022
2 parents a2c18e7 + f47d057 commit 0da3175
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions diamond.c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include<stdio.h>

void main(){
int n , r, c;
printf("enter the number of rows");
scanf("%d",&n);
for(r=1;r<=n;r++)
{
for(c=1;c<=n-r;c++)
{
printf(" ");
}
for (c=1;c<=2*r-1;c++)
{
printf("*");
}
printf("\n");
}
for(r=n-1;r>=1;r--)
{
for(c=1;c<=n-r;c++)
{
printf(" ");
}
for (c=1;c<=2*r-1;c++)
{
printf("*");
}
printf("\n");
}

}

0 comments on commit 0da3175

Please sign in to comment.