using System;
class HelloWorld {
//tao mot ham tu dinh nghia nhan hai tham so
public static int Sum( int num1, int num2)
{
int total;
total = num1 + num2;
return total;
}
public static void Main( )
{
Console.Write ( "\n Tao ham tu dinh nghia de tinh tong hai so trong C#:\n " ) ;
Console.Write ( "--------------------------------------------------\n " ) ;
Console.Write ( "Nhap so hang thu nhat: " ) ;
int n1 = 30 ;
Console.Write ( "Nhap so hang thu hai: " ) ;
int n2 = 50 ;
//goi ham tu dinh nghia
Console.WriteLine ( "\n Tong hai so: {0} \n " , Sum( n1, n2) ) ;
}
}
dXNpbmcgU3lzdGVtOwoKY2xhc3MgSGVsbG9Xb3JsZCB7CiAgICAgLy90YW8gbW90IGhhbSB0dSBkaW5oIG5naGlhIG5oYW4gaGFpIHRoYW0gc28KICAgICAgICBwdWJsaWMgc3RhdGljIGludCBTdW0oaW50IG51bTEsIGludCBudW0yKQogICAgICAgIHsKICAgICAgICAgICAgaW50IHRvdGFsOwogICAgICAgICAgICB0b3RhbCA9IG51bTEgKyBudW0yOwogICAgICAgICAgICByZXR1cm4gdG90YWw7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCiAgICAgICAgewogICAgICAgICAgICBDb25zb2xlLldyaXRlKCJcblRhbyBoYW0gdHUgZGluaCBuZ2hpYSBkZSB0aW5oIHRvbmcgaGFpIHNvIHRyb25nIEMjOlxuIik7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4iKTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiTmhhcCBzbyBoYW5nIHRodSBuaGF0OiAiKTsKICAgICAgICAgICAgaW50IG4xID0gMzA7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIk5oYXAgc28gaGFuZyB0aHUgaGFpOiAiKTsKICAgICAgICAgICAgaW50IG4yID0gNTA7CiAgICAgICAgICAgIC8vZ29pIGhhbSB0dSBkaW5oIG5naGlhCiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJcblRvbmcgaGFpIHNvOiB7MH0gXG4iLCBTdW0objEsIG4yKSk7CgogICAgICAgICAgIAogICAgICAgIH0gICAKfQo=