Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace SumReversedNumbers
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. List<int> seq = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  12. long sum = 0;
  13.  
  14. for (int i = 0; i < seq.Count; i++)
  15. {
  16. int num = seq[i];
  17. string reversed = "";
  18.  
  19. while(num > 0)
  20. {
  21. int lastDigit = num % 10;
  22. reversed += lastDigit;
  23. num /= 10;
  24. }
  25.  
  26. sum += int.Parse(reversed);
  27. }
  28.  
  29. Console.WriteLine(sum);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement