using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace ForgetCode { class Program { static void Main(string[] args) { string text = "My name is Forget Code"; char[] textarray = text.ToCharArray(); for (int i = 1; i < text.Length; i++) { if (textarray[i].Equals('e')) { Console.WriteLine("The letter is present in " + (i+1) + "th position"); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace ForgetCode { class Program { static void Main(string[] args) { string text = "My name is Forget Code"; char[] textarray = text.ToCharArray(); for (int i = 1; i < text.Length; i++) { if (textarray[i].Equals('e')) { Console.WriteLine("The letter is present in " + (i+1) + "th position"); break; } } } } }