Complete the code to declare a method that takes one integer parameter.
void PrintNumber([1] number) {
Console.WriteLine(number);
}The method parameter must have a type. Here, int is the correct type for an integer parameter.
Complete the code to call the method with an argument.
PrintNumber([1]);The method expects an integer argument. Passing 5 (without quotes) is correct.
Fix the error in the method declaration by completing the parameter list.
void Greet([1] name) { Console.WriteLine($"Hello, {name}!"); }
The parameter name should be a string because it holds text.
Fill both blanks to declare a method with two parameters and call it with matching arguments.
void AddNumbers([1] a, [2] b) { Console.WriteLine(a + b); } AddNumbers(3, 4);
Both parameters should be integers to add numbers correctly.
Fill all three blanks to declare a method with parameters and call it with arguments.
void DisplayInfo([1] name, [2] age) { Console.WriteLine($"Name: {name}, Age: {age}"); } DisplayInfo([3], 30);
The method parameters are string and int. The argument for name must be a string literal like "Alice".