C#写乘法口诀表
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 乘法口诀表
{
class Program
{
static void Main(string[] args)
//版本一:
/*{
for (int i = 1; i <=9; i++)
{
for (int j = 1; j <=9; j++)
{
Console.Write("{0}*{1}={2}\t",i,j,i*j);
}
Console.WriteLine();
}
Console.ReadKey();
}*/
//版本二:
{
for (int i = 1; i <=9; i++)
{
for (int j = 1; j <=i; j++)
{
Console.Write("{0}*{1}={2}\t",j,i,i*j);
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
输出结果分别为:
评论区欢迎讨论。