Problem in new driver's license challenge
This code fails in case 3 and 5 I solved the problem using for loop but I think this code is correct too Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { private static void Main() { string name = Console.ReadLine(); int agentsnumber = int.Parse(Console.ReadLine()); string others = Console.ReadLine(); List<string> names = others.Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries).ToList(); names.Add(name); names.Sort(); Console.WriteLine(names.IndexOf(name) + 1); float index= (float)(names.IndexOf(name) + 1) / agentsnumber; Console.WriteLine(Convert.ToInt32(index)*20); } } } Can any one tell me where I am wrong ? Thankyou in advance