+ 2

What is the output of the following program😕 i do it in the compiler but i didn't understand it

using System; namespace ConsoleApplication1{ public class Program { public static void Main(string[] args) { int a = 5; int s = 0, c = 0; Mul (a, ref s, ref c); Console.WriteLine(s + "t " +c); Console.ReadLine(); } static void Mul (int x, ref int ss, ref int cc) { ss = x * x; cc = x * x * x; } } }

29th Jul 2020, 2:32 PM
Ruqiya
1 Antwort
0
A=5 //first parameter of mul method S=0 //second parameter of mil method C=0 // third parameter of mul method Mul (5,0,0) Ss = 5*5 Cc = 5*5*5 Because ss and cc are reference parameter their value is passed to the main method ss is assigned to s because it was the second parameter cc is assigned to c because it was the third parameter. 25t125 And readline to stop the console from dissapearing.
29th Jul 2020, 2:41 PM
sneeze
sneeze - avatar