desislava_topuzakova

5.

Dec 5th, 2021
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05._Winner_Tickets
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. //{цифра на хилядните}{цифра на стотиците}{цифра на десетици}{цифра на единици}
  11. //всички числа от 1111 до 9999 -> проверка дали е печеливш -> принтираме
  12. for (int hil = 0; hil <= 9; hil++)
  13. {
  14. for (int stot = 0; stot <= 9; stot++)
  15. {
  16. for (int des = 0; des <= 9; des++)
  17. {
  18. for (int ed = 0; ed <= 9; ed++)
  19. {
  20. if (hil + ed == n && stot % 2 == 1 && (des == 4 || des == 7))
  21. {
  22. Console.WriteLine($"{hil}{stot}{des}{ed} ");
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment