Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace AsciiSumator
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- char firstSymbol = char.Parse(Console.ReadLine());
- char secondSymbol = char.Parse(Console.ReadLine());
- string text = Console.ReadLine();
- char startSymbol = text[0];
- char endSymbol = text[0];
- int sum = 0;
- if (firstSymbol < secondSymbol)
- {
- startSymbol = firstSymbol;
- endSymbol = secondSymbol;
- }
- else
- {
- startSymbol = secondSymbol;
- endSymbol = firstSymbol;
- }
- foreach (var symbol in text)
- {
- if(symbol>startSymbol && symbol < endSymbol)
- {
- sum += symbol;
- }
- }
- Console.WriteLine(sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement