Advertisement
svetlyoek

Untitled

Feb 13th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp169
  4. {
  5. class Program
  6. {
  7.  
  8. static void Main(string[] args)
  9. {
  10. int number = int.Parse(Console.ReadLine());
  11.  
  12. TopNumber(number);
  13. }
  14.  
  15. private static void TopNumber(int number)
  16. {
  17.  
  18. for (int i = 1; i <= number; i++)
  19. {
  20. int lastDigit = i % 10;
  21. int sum = lastDigit + i / 10;
  22. if (sum % 8 == 0)
  23. {
  24. if (i % 2 == 1)
  25. {
  26. Console.WriteLine(i);
  27. }
  28.  
  29. }
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement