Hi,
Program Definition :: Print Numbers in Cyclical (Maze) Format
Explaination:
Here numbers are to be printed in cyclical format i.e. suppose i enter 4 as input then the output should be of 4×4 in this format
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
If anyone has the answer then please answer it.
Regards,
Siddhesh
2 comments:
#include
#include
void main()
{
int a[100][100];
int c=1,i,j,k,m=0,n,x;
clrscr();
printf(“Enter the number of rows and columns for the square matrix \n”);
scanf(“%d”,&n);
x=n;
while(n>=1)
{
for(k=0;k0;k–)
a[k+m][m]=c++;
n=n-2;
m=m+1;
}
for(i=0;i<x;i++)
{
for(j=0;j<x;j++)
{
printf("%5d",a[i][j]);
}
printf("\n");
}
getch();
}
This is the answer
sorry siddhesh this is the wrong answer.....:)
please find out the correct one........
Post a Comment