Complete the code to declare a method named Greet that prints a message.
void [1]() { Console.WriteLine("Hello!"); }
The method name should be Greet as specified.
Complete the code to call the method named Greet.
class Program { static void Main() { [1](); } }
To call the method, use its exact name Greet followed by parentheses.
Fix the error in the method declaration by completing the missing return type.
[1] Greet() { Console.WriteLine("Hello!"); }
The method does not return a value, so the return type should be void.
Fill both blanks to declare a method named Add that returns the sum of two integers a and b.
static [1] Add(int a, int b) { return a [2] b; }
The method returns an integer, so the return type is int. The sum uses the + operator.
Fill all three blanks to declare and call a method named Multiply that returns the product of two integers x and y.
static [1] Multiply(int x, int y) { return x [2] y; } static void Main() { int result = Multiply([3], 5); Console.WriteLine(result); }
The method returns an integer, so int is the return type. The multiplication operator is *. The method is called with 3 and 5.