Exercise
Function Double reference parameter
Objetive
Create a function named "Double" to calculate the double of an integer number, and modify the data passed as an argument. It must be a "void" function and you must use "refererence parameters". For example.
x = 5;
Double(ref x);
Console.Write(x);
would display 10
Example Code
public class Main
{
public static void Double(int n)
{
n = n + n;
}
public static void main(String[] args)
{
int x = 2;
Double(x);
System.out.println(x);
}
}