First thing, "
shows error i am new to .Net please explain" would not be a statement of a problem. A simple
Google[
^] search would provide you millions of result,so you probably don't try that.
Now the second thing, suggestions provided by
ThePhantomUpvoter and
abbaspirmoradi are quite good,you can follow that.I just see you another way to do it with just 2 lines of code that could add 2 integer numbers.See:
class Program
{
public static int add(int a, int b)
{
return a + b;
}
static void Main(string[] args)
{
Console.WriteLine("additon:" + add(10,10));
}
}
So i changed your
void add()
method to
static int
so that it can return a value and just call it inside the
Main
to print the result.
Cheers!
Shuvro