《21天学通C#》嵌套循环,输出上三角形X。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1_嵌套循环输出X_
{
class Program
{
static void Main(string[] args)
{
int x, y;
for (x=0; x < 10; x++,System.Console.Write("\n"))
{
for(y=0;y<x;y++)
{
System.Console.Write("X");
}
}
Console.WriteLine("请按任意键退出程序!");
Console.ReadKey();
}
}
}

 

posted on 2018-11-05 14:20  天源  阅读(329)  评论(0编辑  收藏  举报

导航