Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication42
- {
- class Program
- {
- static void Main(string[] args)
- {
- int sum = 0;
- using (StreamReader sr = new StreamReader("D:\\New.txt"))
- {
- string result = sr.ReadLine();
- Console.WriteLine(result);
- foreach (char a in result)
- {
- if (char.IsDigit(a))
- sum += a;
- }
- Console.WriteLine(sum);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement