/*Write a program that given a 5x5 matrix of positive integers, prints it in a spiral order. The logic is to traverse the matrix from starting point move right till end is met ,then move down ,then move left and finally move up. Now the outer loop of the matix is printed and we are left with a matrix inside which is of dimension 3X3 for which the same process needs to be followed. Author:rahule@cse.iitk.ac.in */ #include int main() {int i,j,k; int a[5][5]; int n=5; printf("Please input the 5X5 matrix"); for(i=0;i=0+i;j--)//Loop traversing left {printf("%d ",a[k][j]); } j++; k--; for(;k>=0+i+1;k--)//Loop traversing up {printf("%d ",a[k][j]); } } return 0; }