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