using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _1808_21_汪敏 { class Program { static void Main(string[] args) { //for (int j = 1; j <= 10; j++)//外层循环 //{ // for (int i = 1; i <=j; i++)//内层循环 // { // Console.Write((char)(65 + i - 1));//A是65,a是97 // } Console.WriteLine(); //} int n, m; n = Convert.ToInt32(Console.ReadLine()); m = n + 1; for (int j = 1; j <= m; j++)//外层循环 { for (int k = 1; k <=m - j; k++) { Console.Write(" "); } for (int i = 1; i <= j * 2 - 1; i++)//内层循环 { Console.Write("*"); } Console.WriteLine(); } int a=1, b=1, c=1; for ( a = 11; a <= 1; a--)//外层循环 { for (b =11 - a; b <=1;b--) { Console.Write(" "); } for (c = a * 2 - 1; c <= 1; c--)//内层循环 { Console.Write("*"); } Console.WriteLine(); } } } }
标签:21,Generic,System,嵌套循环,static,using From: https://www.cnblogs.com/bky-wang/p/18124609