Hello friends today i am trying to print the following pattern, if you think that this code is long and you have a better solution of this pattern than share with me i really appreciate you....
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *#include<stdio.h>
#include<conio.h>
int main()
{
int i,m,l,k;
clrscr();
for(i=1;i<=25;i++)
printf(" *");
printf("\n");
m=5;
l=1;
for(i=1;i<=3;i++)
{
for(k=1;k<=i;k++)
printf(" ");
printf(" *");
for(k=1;k<=m;k++)
printf(" ");
printf(" *");
for(k=1;k<=l;k++)
printf(" ");
printf(" *");
for(k=1;k<=m;k++)
printf(" ");
printf(" *");
for(k=1;k<=l;k++)
printf(" ");
printf(" *");
for(k=1;k<=m;k++)
printf(" ");
printf(" *");
printf("\n");
m=m-2;
l=l+2;
}
for(k=1;k<=4;k++)
printf(" ");
printf(" *");
for(k=1;k<=7;k++)
printf(" ");
printf(" *");
for(k=1;k<=7;k++)
printf(" ");
printf(" *");
m=5;
l=1;
printf("\n");
for(i=3;i>=1;i--)
{
for(k=1;k<=i;k++)
printf(" ");
printf(" *");
for(k=1;k<=l;k++)
printf(" ");
printf(" *");
for(k=1;k<=m;k++)
printf(" ");
printf(" *");
for(k=1;k<=l;k++)
printf(" ");
printf(" *");
for(k=1;k<=m;k++)
printf(" ");
printf(" *");
for(k=1;k<=l;k++)
printf(" ");
printf(" *");
printf("\n");
m=m-2;
l=l+2;
}
for(i=1;i<=25;i++)
printf(" *");
getch();
return(0);
}
Thanks Friends........
No comments:
Post a Comment
Please Give Me Your Views