C# Programming - Functions and Subroutines - Discussion
Discussion Forum : Functions and Subroutines - General Questions (Q.No. 6)
6.
Which of the following will be the correct output for the C#.NET program given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[] args)
{
int a = 5;
int s = 0, c = 0;
Proc(a, ref s, ref c);
Console.WriteLine(s + " " + c);
}
static void Proc(int x, ref int ss, ref int cc)
{
ss = x * x;
cc = x * x * x;
}
}
}
Discussion:
2 comments Page 1 of 1.
Kannan said:
9 years ago
I have one doubt.
ref always return value? If return type void or any other else?
ref always return value? If return type void or any other else?
Bhupendra chauhan said:
1 decade ago
In this case
The value will return ss=x*x=5*5=25 to s
And cc=x*x*x=5*5*5=125 to c
So output will be 25,125
The value will return ss=x*x=5*5=25 to s
And cc=x*x*x=5*5*5=125 to c
So output will be 25,125
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers