兩種解決方案!!
? ?for (int x = 1; x < 10; x++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (x == 3 || x == 8)? ?//請?zhí)砑哟a,過濾3和8
? ? ? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? }
? ? ? ? ? ? for (int x = 1; x < 10; x++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (x == 3)? //請?zhí)砑哟a,過濾3和8
? ? ? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? ? ? if (x == 8)? //請?zhí)砑哟a,過濾3和8
? ? ? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? }
2022-05-25
朕已閱
2019-09-18
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();//換行
? ? ? ? ? ??
? ? ? ? }
? ? }
}