码迷,mamicode.com
首页 > 其他好文 > 详细

作业:12.23

时间:2014-12-23 17:12:22      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

打印以下图型:
   行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

标签:

原文地址:http://www.cnblogs.com/viven/p/4180417.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!