Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Numerics;
- namespace SumReversedNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> num = Console.ReadLine()
- .Split(' ')
- .ToList();
- long sum = 0;
- List<string> revNums = new List<string>();
- for (int i = 0; i < num.Count; i++)
- {
- string number = num[i];
- char[] arr = number.ToCharArray();
- char[] rev = arr.Reverse().ToArray();
- string reversed = string.Join("", arr);
- long numFinal = long.Parse(reversed);
- sum += numFinal;
- }
- Console.WriteLine(sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment