|  | 
|  | 
| back to board | Why I get a runtime error (C#) Posted by Stepan  21 Feb 2020 00:39List<long> coll = new List<long>();List<decimal> answer = new List<decimal>();
 List<string> a = new List<string>();
 string line;
 while (true)
 {
 line = Console.ReadLine();
 
 answer.Clear();
 coll.Clear();
 a.AddRange(line.Split());
 a.RemoveAll(x => x.Equals(""));
 
 for (int i = 0; i < a.Count; i++)
 {
 coll.Add(long.Parse(a[i]));
 
 }
 
 for (int i = 0; i < coll.Count; i++)
 {
 var d = (decimal)Math.Sqrt(coll[i]);
 answer.Insert(0, d);
 }
 Console.Clear();
 for (int i = 0; i < answer.Count; i++)
 {
 
 Console.WriteLine(answer[i].ToString("0.0000##"));
 }
 }
 
 
 Edited by author 21.02.2020 00:40
 | 
 | 
|