Hollow Daimond Star Pattern Program in C
#include<stdio.h>
int main()
{
int n=9; //size
int px=n/2+1; //print controls (mid)
int i,j; //loop var
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(j==px || j==n-px+1)
{
printf("*");
}
else
{
printf("");
}
}
if(i<=n/2)
px--;
else
px++;
printf("\n");
else
px++;
printf("\n");
}
return 0;
}
No comments:
Post a Comment