Exercise
Function with parameters
Objetive
Write a C# program whose Main must be like this:
public static void Main()
{
SayHello("John");
SayGoodbye();
}
SayHello and SayGoodbye are functions that you must define and that will be called from inside Main. As you can see in the example. SayHello must accept an string as a parameter.
Example Code
using System;
class Program
{
public static void SayHello(string name)
{
Console.WriteLine($"Hello, {name}! Welcome to the program.");
}
public static void SayGoodbye()
{
Console.WriteLine("Goodbye, thanks for using the program!");
}
public static void Main()
{
SayHello("John");
SayGoodbye();
}
}