#include <stdio.h>
void main() {
int m[2][2]={
{2,1},
{3,7}
};
int i,j;
printf("\n----Current Matrix----\n\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf(" %d ",m[i][j]);
}
printf("\n");
}
printf("\n----Matrix After 90 Degree Clockwise Rotation----\n\n");
for(i=0;i<2;i++)
{
for(j=1;j>=0;j--)
{
printf(" %d ",m[j][i]);
}
printf("\n");
}
printf("\n----Matrix After 90 Degree Anti-clockwise Rotation----\n\n");
for(i=1;i>=0;i--)
{
for(j=0;j<2;j++)
{
printf(" %d ",m[j][i]);
}
printf("\n");
}
printf("\n----Matrix After 180 Degree Rotation----\n\n");
Comments