Programming Course in C# ¡Free!

Functions: greeting + farewell

 Saturday, April 06, 2013 published by Exercises C#
Proposed exercise

Create a program whose Main must be like this:

public static void Main()
{
    SayHello();
    SayGoodbye();
}

SayHello and SayGoodbye are functions that you must define and that will be called from inside Main.

Output



Solution


using System;
class GreatingAndFarewell
{
public static void SayHello() 
{
Console.WriteLine("Hello!");
}

public static void SayGoodbye()
{
Console.WriteLine("Good Bye!");
}

public static void Main()
{
SayHello();
SayGoodbye();
}
}