有比這簡單的方法嗎?
for (int y = 1; y <= 1; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ?for (int f = 1; f<= 1; f++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(f);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? ?for (int e = 1; e<= 2; e++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(e);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? ?for (int d = 1; d<= 3; d++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(d);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? ?for (int c = 1; c <= 4; c++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(c);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? ? for (int b = 1; b <= 5; b++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(b);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? ? ? for (int a = 1; a <= 6; a++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(a);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? ? ? for (int x = 1; x <= 7; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
2020-05-02
for (int x = 1; x <= 7; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if(x>y)
? ? ? ? ? ? ? ? ? ? {continue;}
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
2020-03-03
改一個變量就行,只需要一個字母哦。
2020-02-08
在最里面的循環(huán)加上這個條件就行if(x>y){ break;}就行!?
2020-02-02
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for (int y = 1; y <= 7; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int x = 1; x <= y; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2020-01-28
static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for (int y = 1; y <= 7; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int x = 1; x <= 7; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if(x>y){
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
? ? ? ? }
2020-01-23
for (int y = 1; y <= 7; y++)
{
????for (int x = 1; x <= y; x++)
????{
????????Console.Write(x);
????}
????Console.WriteLine();//換行
}
2020-01-07
static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for (int y = 1; y <= 7; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int x = 1; x <= y; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
? ? ? ? }
2020-01-07
? ? ? ? ? ? ? ? ? ? if (x == y)
2019-10-25
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for (int y = 1; y <= 7; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int x = 1; x <= y; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2019-10-14
for (int y = 1; y <= 7; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int x = 1; x <= y; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }