Write a simple application that accept 5 names from a user, and prints the names out in the reverse order. example Ben,Amavi,Peace,Amoo,Nester. Should be printed out as Nester,Amoo,Peace,Amavi and Ben.(Note use function to implement this program)
using System;
namespace ReverseNamesOrder
{
class Program
{
static void Main(string[] args)
{
string[] names = new string[5];
// Read names
Console.WriteLine("Enter five names, please. One by line.");
for (int i = 0; i < 5; i++)
{
names[i] = Console.ReadLine();
}
// Write reverse order
Console.WriteLine();
Console.WriteLine("Reverse order: ");
for (int i = 4; i >=0; i--)
{
Console.WriteLine(names[i]);
}
// Delay
Console.ReadKey();
}
}
}