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
Is cli same as the clr?
What is the value which is accepted by all data types ?
How do you prevent a method from being overridden in c#?
What is an Interface in C#?
Describe two uses of the “using” statement during the operation of c#?
What are the boolean data types in c#?
Explain the security with aop?
What are the advantages of using partial classes?
Is c# a backend language?
How will you deploy the dll file in gac?
Can we inherit two classes in c#?
Which is faster hashtable or dictionary?
What do you understand by 'access specifiers' in C#?
What is the difference between select and selectmany?
Is string a class in c#?