Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class NightmareOnCodeStreet
- {
- static void Main()
- {
- string number = Console.ReadLine();
- int oddCount = 0;
- int sum = 0;
- for (int i = 0; i < number.Length; i++)
- {
- char symbol = number[i];
- if (char.IsDigit(symbol))
- {
- char digit = symbol;
- if (i % 2 == 1)
- {
- oddCount++;
- sum += int.Parse(digit.ToString());
- }
- }
- }
- Console.WriteLine("{0} {1}", oddCount, sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement