Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class EqualSumsEvenOddPosition
- {
- static void Main(string[] args)
- {
- int start = int.Parse(Console.ReadLine());
- int end = int.Parse(Console.ReadLine());
- for (int i = start; i <= end; i++)
- {
- int currentNumber = i;
- int oddSum = 0;
- int evenSum = 0;
- while (currentNumber > 0)
- {
- oddSum += currentNumber % 10;
- currentNumber /= 10;
- evenSum += currentNumber % 10;
- currentNumber /= 10;
- }
- if (oddSum == evenSum)
- {
- Console.Write(i + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement