Skip to content

Commit

Permalink
Merge pull request #371 from VSNSAINIVAS/main
Browse files Browse the repository at this point in the history
Added beautiful star pattern
  • Loading branch information
strang3-r authored Oct 31, 2022
2 parents 714ef3c + 19f4d07 commit 01e465f
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions star_pattern.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include<stdio.h>
int main()
{
int a,b,mod=5,k,i,z,c;
a=1;
printf("\n\n\n");
while(a<=6)
{
printf("\t\t");
b=0;
printf(" ");
while(b<6-a)
{
printf(" ");
b=b+1;
}
b=0;
while(b<a)
{
printf("*");
printf(" ");
b=b+1;
}
printf("\n");
a=a+1;
}
a=5;
b=19;
i=0;
while(a<=10){
printf("\t\t");
k=b;
z=i;
for(z;z>0;z--){
printf(" ");
}
for(k;k>=0;k--){
printf("* ");
}
printf("\n");
i = i+1;
b = b-2;
a = a+1;
}
while(mod>=0){
printf("\t\t");
z=mod+3;
while(z>0){
printf(" ");
z = z-1;
}
printf(" ");
for(k=1;k<=mod;k++){
printf("* ");
}
for(i=1;i<=2*(a-2*mod);i++){
printf(" ");
}
for(k=1;k<=mod;k++){
printf("* ");
}
printf("\n");
mod=mod-1;
a = a+1;
}
return 0;
}

0 comments on commit 01e465f

Please sign in to comment.