C#-练习题
程序员文章站
2022-12-25 17:07:58
1、输入两个数,将两个数交换后输出 结果 ......
1、输入两个数,将两个数交换后输出
1 using system; 2 3 namespace exchangetwonumbers 4 { 5 class exchangetwonumbers 6 { 7 static void main(string[] args) 8 { 9 console.writeline("enter two integers and end with the enter key"); 10 console.write("please input a:"); 11 int a = convert.toint32(console.readline()); 12 console.write("please input b:"); 13 int b = convert.toint32(console.readline()); 14 15 a = a - b; 16 b = a + b; 17 a = b - a; 18 19 console.writeline("a is:{0}", a); 20 console.writeline("b is:{0}", b); 21 console.readkey(); 22 } 23 } 24 }
结果
上一篇: ASP.NET Core 2 学习笔记(十二)REST-Like API
下一篇: linux笔记