Skip to content

Commit

Permalink
by utkarsh
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshhh1 committed Nov 18, 2022
1 parent 980c573 commit f47d057
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 f47d057

Please sign in to comment.