代码:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace for循环语句2 { class Program { static void Main(string[] args) { for (int x = 1; x <= 9; x++)//控制列 { for (int y = 1; y <= x; y++) { Console.Write(y + "x" + x + "=" + y * x + " "); } Console.WriteLine();//有换行的功能 } Console.Read(); } } }
运行结果: