#代碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? Console.Write("請輸入直角三角形的行數(shù)");
? ? ? ? ? ? int hang = Convert.ToInt32(Console.ReadLine());
? ? ? ? ? ? for (int i = 0; i < hang+1; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int j = 0; j < 2*i-1; j++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write("*");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine("");
? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}
#效果
