} publicstaticvoidMain(string[] args) { int sum = 0;
Console.Write("Enter a: "); int a = int.Parse(Console.ReadLine());
Console.Write("Enter b: "); int b = int.Parse(Console.ReadLine());
swap();
Console.WriteLine("Swap a and b");
Console.WriteLine("a={0} b={1}",a,b);
Console.ReadKey(); } }
ข้อที่ 1.3
usingSystem;
classRefExample{staticvoidReadTwoNums()
{
Console.WriteLine("Enter two number:");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
}staticvoidMain()
{int n1 = 0, n2 = 0;
ReadTwoNums();
Console.WriteLine("Numbers are {0} and {1}", n1, n2);
Console.ReadKey();
}}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น