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 / anandraj
class Program
{
void add()
{
int x = 10, y = 20,sum;
fun(x,y,out sum);//changing the parameters
Console.WriteLine("{0}", sum);
}
void fun(int x,int y,out int sum)//changing the
parameter and using out keyword
{
sum = x + y;
}
static void Main(string[] args)
{
Program f = new Program();
f.add();
}
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is form feed and carriage return?
What is the difference between static class and abstract class in c#?
What are the different types of assemblies available and their purpose?
What is called method in c#?
Differentiate between the public and private ?
How to use nullable types in .net?
Which is faster hashtable or dictionary?
What are the types in c#?
What are logical operators in c#?
Is string a data type in c#?
Can we override static class in c#?
How to add controls dynamically to the form using c#.net.
What is icomparer in c#?
What is form feed in c#?
Explain About Iunknown interface Queue