作业要求
定义两个变量:number1 ,number2并赋值,并使两个变量赋值交换(注:不得添加临时变量)
代码
int number1 = 10;
int number2 = 5;
Console.WriteLine("number1={0},number2={1}", number1, number2);
number1 = number1 + number2;//number1 = 15
number2 = number1 - number2;//number2 = 10
number1 = number1 - number2;//number1 = 5
Console.WriteLine("↓替换后");
Console.WriteLine("number1={0},number2={1}", number1, number2);
Console.ReadKey();
··
输出结果
好像很厉害的样子今天加了注释
网友评论