Today I was working on c sharp and I'm trying out static classes, but it doesn't seem to work for me and I would love to know the solution. I have been browsing around the web for a while now but I can't seem to find the answer.
Here is my code:
class Count
{
public static int sum(int add1, int add2)
{
int result = add1 + add2;
return result;
}
}
class Program
{
static void Main(String[] args)
{
Console.WriteLine("Adding: \nPlease enter the first number");
int num1 = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter the second number");
int num2 = int.Parse(Console.ReadLine());
Count add = new Count();
int total = add.sum(num1, num2);
Console.WriteLine("The sum is {0}.", total);
Console.ReadLine();
}
}