Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace RefactorSpecialNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num = int.Parse(Console.ReadLine());
- for (int i = 1; i <= num; i++)
- {
- int sum = 0;
- int counter = i;
- while (i > 0)
- {
- sum += i % 10;
- i /= 10;
- }
- bool special = (sum == 5) || (sum == 7) || (sum == 11);
- Console.WriteLine($"{counter} -> {special}");
- i = counter;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement