CODE: ( by Linear Search)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] batsmans = new string[]{"M Ali","Haeeb","Tahir","Usama","Butt","Afradi","Inzimam","Shoaib","Asad","Raja","Umer"};
            for (int j = 0; j < 11; j++)
            {
                    Console.Write("{0}\t",batsmans[j]);
            }
            Console.WriteLine("\n\nPlz
Enter The Name of Batsman for His Coming Position");
            string name = Console.ReadLine();
            Console.WriteLine("At:\t");
            for (int j = 0; j < 11; j++)
            {
                if (batsmans[j] == name)
                {
                    Console.WriteLine(j+1);
                }
            }
        }
    }
}

 
No comments:
Post a Comment