Question #288878

You need to maintain a contact list in a generic list collection. You need time perform the following tasks i- add contact () - To add contact details to list





Expert's answer

using System;
using System.Threading;

namespace Contact
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            string[] names = new string[20];
            string[] numbers = new string[20];
            string[] email = new string[20];
            string[] state = new string[20];
            for (int i = 0; i < 100; i++)
            {
                Console.Write($"Name of contact {i+1}: ");
                names[i] = Console.ReadLine();
                Console.Write($"Mobile number of a {i+1} contact: ");
                numbers[i] = Console.ReadLine();
                Console.Write($"Email of a {i+1} contact: ");
                email[i] = Console.ReadLine();
                Console.Write($"State of a {i+1} contact: ");
                state[i] = Console.ReadLine();
                Console.WriteLine($"\nName: {names[i]}");
                Console.WriteLine($"Mobile number: {numbers[i]}");
                Console.WriteLine($"Email: {email[i]}");
                Console.WriteLine($"State: {state[i]}\n");
                Thread.Sleep(1000);
            }
        }
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS