其他分享
首页 > 其他分享> > 随机生成口算题

随机生成口算题

作者:互联网

 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             }

 

标签:int,random,生成,Write,随机,Debug,100,Math,算题
来源: https://www.cnblogs.com/xiaokang088/p/16360939.html