*000*000*
0*00*00*0
00*0*0*00
000***000
int main()
{
int i,j,k;
for(i=1;i<=4;i++)
{
for(j=1;j<=9;j++)
{
if(j==i || j==5 || 10-j==i)
printf("*");
else
printf("0");
}
printf("\n");
}
return 0;
}
Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C
it can also be the solution bro :P
ReplyDelete#include
int main()
{
int i,j;
int p,c1,c2;
p = 1;
c1 = 1;
c2 = 9;
for(i=1;i<=4;i++)
{
for(j=1;j<=9;j++)
{
if(i==p&&(j==c1||j==c2||j==5))
printf("*");
else
printf("0");
}
p++;
c1++;
c2--;
printf("\n");
}
return 0;
}
#include
ReplyDeletemain()
{
int i,j,n=3,k;
for(i=0;i<=n;i++)
{
for(j=1;j<=i;j++)printf("0");
for(j=1;j<=n;j++)
{
printf("*");
if(j!=n)for(k=1;k<=(n-i);k++)
printf("0");
}
for(j=1;j<=i;j++)printf("0");
printf("\n");
}
}
#include
ReplyDeleteint main()
{
int r,i,j;
printf("Enter the no. of rows : ");
scanf("%d",&r);
for(i=1;i<=r;i++)
{
for(j=1;j<=i-1;j++)
{
printf("0");
}
printf("*");
for(j=1;j<=r-i;j++)
{
printf("0");
}
printf("*");
for(j=1;j<=r-i;j++)
{
printf("0");
}
printf("*");
for(j=1;j<=i-1;j++)
{
printf("0");
}
printf("\n");
}
return 0;
}
What if the no of rows are given in the command line?
Deletewhy you use 9 inside "j" loop?
ReplyDeletesusymsem-mu Patrick Herman https://marketplace.visualstudio.com/items?itemName=8tacultine.My-Dear-Frankenstein--English-Edition--gratuita
ReplyDeleteonothmire
VperfneWplic-bu1998 Troy Fifer click
ReplyDeleteclick
download
click
horomrirest