JulianJulianov

SumOfChars

Jan 29th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04SumOfChars
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var input = int.Parse(Console.ReadLine());
  10.  
  11. int totalSum = 0;
  12. int digit = 0;
  13. for (int i = 1; i <= input; i++)
  14. {
  15. string letter = Console.ReadLine();
  16. digit = letter[0];
  17. totalSum += digit;
  18. }
  19. Console.WriteLine($"The sum equals: {totalSum}");
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment