两种解决方案!!
for (int x = 1; x < 10; x++)
{
if (x == 3 || x == 8) //请添加代码,过滤3和8
continue;
Console.Write(x);
}
for (int x = 1; x < 10; x++)
{
if (x == 3) //请添加代码,过滤3和8
continue;
if (x == 8) //请添加代码,过滤3和8
continue;
Console.Write(x);
}
for (int x = 1; x < 10; x++)
{
if (x == 3 || x == 8) //请添加代码,过滤3和8
continue;
Console.Write(x);
}
for (int x = 1; x < 10; x++)
{
if (x == 3) //请添加代码,过滤3和8
continue;
if (x == 8) //请添加代码,过滤3和8
continue;
Console.Write(x);
}
2019-09-14
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
//请完善代码
for(int i=1;i<=7;i++){
for(int j=1;j<=7;j++){
if (i == j || i + j == 8)//对角线打印O
{
Console.Write("O");
}
else
{
Console.Write(".");//其他位置打印.
}
}
}
Console.WriteLine();//换行
}
}
}
举报