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