首页 > 代码库 > 作业:12.23
作业:12.23
打印以下图型:
行i 列j i与j关系
●●●●● 1 5
●●●●● 2 5
●●●●● 3 5
●●●●● 4 5
●●●●● 5 5
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Class1 9 {10 //五行五列11 static void Main(string[] args)12 {13 for (int i = 1; i <= 5;i++ )14 {15 for (int j = 1; j <= 5;j++ )16 {17 Console.Write("*");18 }19 Console.WriteLine();20 }21 }22 }23 }
● 1 1 j<=i
●● 2 2
●●● 3 3
●●●● 4 4
●●●●● 5 5
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Class2 9 {10 static void Main(string[] args)11 {12 for (int i = 1; i <= 5;i++ )13 {14 for (int j = 1; j <= i;j++ )15 {16 Console.Write("*");17 }18 Console.WriteLine();19 }20 }21 }22 }
●●●●● 1 5 j<=6-i
●●●● 2 4
●●● 3 3
●● 4 2
● 5 1
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Class3 9 {10 static void Main(string[] args)11 {12 for (int i = 1; i <= 5;i++ )13 {14 for (int j = 1; j <= 6 - i;j++ )15 {16 Console.Write("*");17 }18 Console.WriteLine();19 }20 }21 }22 }
□□□□●
□□□●●
□□●●●
□●●●●
●●●●●
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Class5 9 {10 static void Main(string[] args)11 {12 for (int i = 1; i <= 5;i++ )13 {14 for (int j = 1; j <= 5 - i;j++ )15 {16 Console.Write(" ");17 }18 for (int m = 1; m <= i;m++ )19 {20 Console.Write("*");21 }22 Console.WriteLine();23 }24 }25 }26 }
□□□□●
□□□●●●
□□●●●●●
□●●●●●●●
●●●●●●●●●
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Class4 9 {10 static void Main(string[] args)11 {12 for (int i = 1; i <= 5;i++ )13 {14 for (int m = 1; m <= 5 - i;m++ )15 {16 Console.Write(" ");17 }18 for (int j = 1; j <= (2 * i - 1);j++ )19 {20 Console.Write("*");21 }22 Console.WriteLine();23 }24 }25 }26 }
作业:12.23
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。