Guys ..
Im a newbie to C# and I need some guidance to rectify this confusion I'm facing.
What I wanted to create is a simple calculation and I can do it in the Main method it self. But I Created a Class named "add" so that I can call it to in the main method.
I initialized int i and j in the main program and why cant I use it in the add class?
Below is my code snippet
Error which I'm getting is
Im a newbie to C# and I need some guidance to rectify this confusion I'm facing.
What I wanted to create is a simple calculation and I can do it in the Main method it self. But I Created a Class named "add" so that I can call it to in the main method.
I initialized int i and j in the main program and why cant I use it in the add class?
Below is my code snippet
Code:
using System;
namespace AddMinusDivideMultiply
{
class Program
{
public static void Main(string[] args)
{
Console.Write("Please Enter The First Number :");
string temp = Console.ReadLine();
int i = Int32.Parse(temp);
Console.Write("Please Enter The Second Number :");
temp = Console.ReadLine();
int j = Int32.Parse(temp);
Addition.Add();
}
}
class Addition
{
public static void Add()
{
int add;
add = i + j;
Console.WriteLine("The Addition Of The First and The Second Number is {0}", add);
}
}
}
Please explain.. Thank you in advance...Error 1 The name 'i' does not exist in the current context
Error 1 The name j' does not exist in the current context



using global static variables 
