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 are the fundamental differences between value types and reference types?

1001


Can you explicitly call a destructor?

875


What are All kind of access specifiers for a class and for methods

1002


Can you inherit multiple abstract classes in c#?

877


What is static variable in c#?

897


Please write a program to display “welcome to bestinterviewquestion.com” in c#?

865


What is c sharp used for?

832


Explain streamreader/streamwriter class?

938


How big is int16?

862


What is a console?

852


Is c# the same as d flat?

856


Is it true that all c# types derive from a common base class?

1004


What is a dictionary in c#?

840


Can I use ReaderWriterLock instead of Monitor.Enter/Exit for Threading?

924


What is ilist c#?

881