using System; using System.IO; public class MyygiSumma{ public static void Main(string[] arg){ try{ double summa=0; foreach(string rida in File.ReadAllLines("myyk.txt")){ string[] m=rida.Split(); Console.WriteLine("{0} EUR, {1} tk.", m[0], m[1]); summa+=double.Parse(m[0].Replace('.', ','))*int.Parse(m[1]); } Console.WriteLine(summa); } catch(FileNotFoundException ex){ Console.WriteLine("Faili ei leitud: "+ex.FileName); } catch(FormatException fe){ Console.WriteLine("Vigane sisu: "+fe.Message); } } }