打印的五角形模型
//※※※※★※※※※
//※※※★★★※※※
//★★★★★★★★★
//※★★★★★★★※
//※※★★★★★※※
//※※★★※★★※※
//※※★※※※★※※
//1、第一部分 //※※※※★ //※※※★★★ for (int i = 1; i <= 2; i++)//s*(2/7) { string a = ""; for (int j = 1; j <= 3 - i; j++) { a += "♀"; } for (int j = 1; j <= 2 * i - 1; j++) { a += "★"; } Console.WriteLine("♀♀" + a); } //2、第二部分 //★★★★★★★★★ //※★★★★★★★ //※※★★★★★ for (int i = 3; i <= 5; i++) { string a = ""; for (int j = 1; j <= i - 3; j++) { a += "♀"; } for (int j = 1; j <= 15 - 2 * i; j++) { a += "★"; } Console.WriteLine(a); } //3、第三部分 //※※★★※★★※※ //※※★※※※★※※ for (int i = 6; i <= 7; i++) { string a = ""; for (int j = 1; j <= 8 - i; j++) { a += "★"; } for (int j = 1; j <= 2 * i - 11; j++) { a += "♀"; } for (int j = 1; j <= 8 - i; j++) { a += "★"; } Console.WriteLine("♀♀" + a); } Console.ReadKey();
时间: 2024-10-17 05:11:22