更新时间2018-03-06 21:31:28
class MathopsApp
{
static void Main(string[] args)
{
// The System.Pandom class is part of the .NET
// Framework class library. Its default constructor
// seeds the Next method using the current date/time.
Random rand = new Random();
int a, b, c;
a = rand.Next() % 100; // Limit max to 99.
b = rand.Next() % 100; // Limit max to 99.
Console.WriteLine("a={0} b={1}", a, b);
c = a * b;
Console.WriteLine("a * b = {0}, c");
// Note the following code uses integers. Therefore.
// if a is less than b, the result will always
// be 0. To get a more accurate result, you would
// nee to use variables of type double or float.
c = a / b;
Console.WriteLine("a / b = {0}", c);
c = a + b;
Console.WriteLine("a + b = {0}", c);
c = a - b;
Console.WriteLine("a - b = {0}", c);
c = a % b;
Console.WriteLine("a % b = {0}", c);
}
}
随机数,ab的加、减、除,取余
上一篇:求讲解以下代码
下一篇:怎么用icon设置响度均衡