随机生成口算题

 1   Random random = new Random();
 2             for (int i = 0; i < 100; i++)
 3             {
 4                 if (i % 3 == 0)
 5                     Debug.WriteLine(string.Empty);
 6 
 7                 int a = random.Next(1, 1000);
 8                 int b = random.Next(1, 1000);
 9 
10                 if (a > 100)
11                 {
12                     Debug.Write(Math.Round(a / 100d, 2));
13                 }
14                 else
15                     Debug.Write(a);
16 
17                 Debug.Write("+");
18 
19 
20                 if (b > 100)
21                 {
22                     Debug.Write(Math.Round(b / 100d, 2));
23                 }
24                 else
25                     Debug.Write(b);
26 
27               
28                 Debug.Write("=");
29                 Debug.Write("              ");
30 
31             }

 

posted @ 2022-06-09 19:49  xiaokang088  阅读(185)  评论(0编辑  收藏  举报