网上看到的这题,下面贴出源代码
using UnityEngine;
using System.Collections;
public class c99 : MonoBehaviour//C#脚本名:c99
{
void OnGUI()
{
#region
const float offsetX = -30;
const float offsetY = -10;
const float width = 80;
const float height = 30;
Rect position;
string formula;
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= i; j++)
{
position = new Rect(j * width + offsetX, i * height + offsetY, width, height);
formula = string.Format("{0} x {1} = {2}", j, i, i*j);
GUI.Label(position, formula);
// Debug.Log(formula);
} }
#endregion
}
}