Skip to content

Commit

Permalink
adding a c file of pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Adishri24 committed Nov 18, 2022
1 parent 980c573 commit 474cbc8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pattern.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>

int main()
{
int n,m;
printf("Enter the number of rows");
scanf("%d",&n);
m=n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m-1;j++)
{
printf(" ");
}
for(int k=1;k<=2*i-1;k++)
{
if(k==1 || k==2*i-1 || i==n)
printf("*");
else
printf(" ");
}
m--;

printf("\n");
}
return 0;
}

0 comments on commit 474cbc8

Please sign in to comment.