- 1
Could someone teach me the answer to this question?
What is the output of this code? static int Vol(int x, int y=3, int z=1) { return x*y*z; } static void Main(string[] args) { Console.WriteLine(Vol(2, 4)); }
6 Answers
+ 4
The answer is 8 because x = 2, y = 4, z = 1.
If we didn't pass any value to the parameter y, then the default value will be 3. In this case, variable y receives a value of 4, then y = 4 and variable z does not receive any value in calling method, default value of z will be used instead.
0
Great...!
0
Thanks for the answer
0
Lol I still don't understand it but i'll move on