You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
597 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<stdio.h>
//任务一,格式化输出数组
int main()
{
//Step1键盘输入81个数
int num[82]={0};
for(int i=0;i<81;i++)
{
scanf("%d",&num[i]);
}
//Step2格式化输出
//首先按一行一行输出,每三行就换一行以做区分
for(int i=0;i<9;i++)
{
printf("|");//每一行的以|开始
for(int j=0;j<9;j++)
{
printf("%d",num[9*i+j]);
if((j+1)%3==0)
{
printf("|");//区分3*3
if(j==8)
{
printf("\n");
}
}
}
if((i+1)%3==0&&i!=8)
{
printf("|----分割---|\n");
}//每三行就换一行
}
}