```i learn c++ and i begin learn c#, i dont understand method of https://htmlwizards.com/pops_iox-pak/ help me error
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace text1 { class Program { public int pt(int l, int r) { return l + r; } static void Main(string[] args) { float i; var c = 10; Console.WriteLine("Hello World"); Console.ReadLine(); for (i = 1; i <= 10; i++) { Console.WriteLine("Hello World"); Console.WriteLine(c);
};
string a, b;
a = "vu anh";
b = "dep trai";
Console.WriteLine(a + " " + b);
int j;
j = pt(3, 4);
Console.WriteLine(i);
Console.Beep();
Console.ReadLine();
}
}
}
An alternative to requiring that you create an instance of Program is that you make pt() itself a static method. Since pt() only operates on its parameters (i.e. it doesn't reference any instance members of its defining type) making it static is an appropriate choice.
Solution 1
Since Main is static, you cannot use the rest of the Program Class inside your static method.
Therefore you need an instance of the Program Class.
Change
int j;
j = pt(3, 4);
```