不太懂這段代碼if(x>=y)break;
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 <= 7; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? ? ? ? ? if(x>=y)
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2017-07-28
y代表有幾行,x代表每行的數(shù)據(jù)。因?yàn)檩敵龅氖侨切?,那么判斷條件就是當(dāng)單行的數(shù)字大于行數(shù)時(shí),結(jié)束該行,開始下一行。