Hello Friends...
I'm writing a C program to print pattern of swastik using *. I want to set my pattern in the center of the screen. Can anyone tell me how can I do this ????
Below is the C program for swastik, but it do not print swastik in the center.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
again:
printf("\n Enter Value for n (odd) : ");
scanf("%d",&n);
if(n%2==0)
goto again;
clrscr();
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(j==0 && i<=(n-1)/2 || j==n-1 && i>=(n-1)/2
|| i==0 && j>=(n-1)/2 || i==n-1 && j<=(n-1)/2
|| i==(n-1)/2 || j==(n-1)/2)
printf("* ");
else
printf(" ");
}
printf("\n\n");
}
getch();
}