解题思路:
感觉有不必要的步骤,希望有大佬能指出来
注意事项:
参考代码:
#include <stdio.h>
int main(void)
{
int three[3][3];
int t; //作为中间变量
for(int j=0;j<=2;j++)
{
for(int k=0;k<=2;k++)
scanf("%d",&three[j][k]);
}
int j=0,k=0;
for(int j=0;j<=2;j++)
{
if(j==1&k==0)
{
t=three[j][k];
three[j][k]=three[k][j];
three[k][j]=t;
}
if(j==2&k==0)
break;
else
{
for(int k=0;k<=2;k++)
{
t=three[j][k];
three[j][k]=three[k][j];
three[k][j]=t;
}
}
}
//输出
j=0,k=0;
for(int j=0;j<=2;j++)
{
for(int k=0;k<=2;k++)
{
printf("%d ",three[j][k]);
if(k==2) printf("\n");
}
}
return 0;
}
0.0分
0 人评分