#include<stdio.h>
#include<stdlib.h>
void main()
{
int n=0,i=1,j=1,s;
clrscr();
printf("Input the n of your square: ");
scanf("%d", &n);
s=n+1;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if((i==1 || i==n) || (j==1 || j==n) || (i==j) || j==s-i)
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("\n\n");
}
getch();
}
DownLoad
#include<stdlib.h>
void main()
{
int n=0,i=1,j=1,s;
clrscr();
printf("Input the n of your square: ");
scanf("%d", &n);
s=n+1;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if((i==1 || i==n) || (j==1 || j==n) || (i==j) || j==s-i)
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("\n\n");
}
getch();
}
DownLoad
Pattern in C
Reviewed by Unknown
on
12:28 pm
Rating:
No comments: