Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

class Program
{




void add()
{
int x=10, y=20;
fun();
Console.WriteLine("{0}", sum);

}

void fun()
{
int sum;
sum = x + y;

}
static void Main(string[] args)
{
Program f =new Program();
f.add();

}
}

Debug above program.....

Answer Posted / simhachalam

Actually you defined x,y variable in add() function so that
variables you can't access outside of method .finally u got
error is undefined variables x,y.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between method parameters and method arguments. Give an example?

923


What is the implicit name of the parameter that gets passed into the class set method?

966


What is instantiating a class?

926


what is c# command?

976


Explain the difference between “system.array.clone()” and “system.array.copyto()” in c#?

916


Is collection a data structure?

943


I was trying to use an out int parameter in one of my functions. How should I declare the variable that I am passing to it?

980


Can a private virtual method can be overridden?

978


Are multiple data types stored in System.Array?

1176


Can abstract class be instantiated c#?

926


What happens during the process of boxing?

1057


How long does it take to learn c# programming?

901


Explain the concepts of cts and cls(common language specification).

964


How do I register my code for use by classic com clients?

880


What is sealed class in c#?

888