adplus-dvertising
frame-decoration

Question

Which of the following will be the correct output for the C#.NET program given below?

namespace CompSciBitsConsoleApplication
{ 
    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;
        } 
    } 
}

a.

0 0

b.

25 25

c.

125 125

d.

25 125

Posted under C# programming

Answer: (d).25 125

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following will be the correct output for the C#.NET program given below?