+ 2

Write a method to find first not repeated digit of a given interger number by c#

example we have (679683978) we need to print 3 is non repeated

21st Nov 2017, 7:10 PM
Zeyad Sharo
Zeyad Sharo - avatar
2 Respuestas
+ 2
thank you so much #Md.Almajed
21st Nov 2017, 10:30 PM
Zeyad Sharo
Zeyad Sharo - avatar
+ 1
Please check the following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int numValue = 679683978; int[] numArray = numValue.ToString().Select(o => Convert.ToInt32(o.ToString())).ToArray(); foreach(int num in numArray){ if(numArray.Where(o => o == num).Count() == 1){ Console.WriteLine(num); break; } } } } } You can check the output here: https://code.sololearn.com/cPaXeaMf2oHi
21st Nov 2017, 9:58 PM
Md. Almajid KOUSHiK
Md. Almajid KOUSHiK - avatar