Functions: greeting + farewell Learn programming C#



Lesson:

Functions


Exercise:

Functions: greeting + farewell


Objetive:

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.


Code:

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

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

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



Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.