Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int oddSum=0;
- int evenSum=0;
- for (int i=n; i<=m; i++)
- {
- int lastEvenDigit = i%10;
- int remove1 = i/10;
- int lastOddDigit = remove1%10;
- int remove2 = remove1/10;
- int secondEvenDigit = remove2%10;
- int remove3 = remove2/10;
- int secondOddDigit = remove3%10;
- int remove4 = remove3/10;
- int firstEvenDigit = remove4%10;
- int remove5 = remove4/10;
- int firstOddDigit = remove5%10;
- evenSum = lastEvenDigit + secondEvenDigit + firstEvenDigit;
- oddSum = lastOddDigit + secondOddDigit + firstOddDigit;
- if (evenSum==oddSum)
- {
- Console.Write(" "+i);
- }
- evenSum=0;
- oddSum=0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement