Advertisement
osman1997

egn

Aug 30th, 2020 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Loop
  4. {
  5. class ForEachLoop
  6. {
  7. public static void Main(string[] args)
  8. {
  9. //за да работи програмата, годините трябва да са м-у (40-99), месеците(1-12), дните(1=31), иначе ше иска ново въвеюдане, докато не се получи правилното егн..
  10.  
  11. bool isTrue = true;
  12.  
  13. while (isTrue)
  14. {
  15. long egn = long.Parse(Console.ReadLine());
  16.  
  17. if (egn.ToString().Length == 10)
  18. {
  19. if ((((egn / 100000000) % 100) >= 40) && (((egn / 100000000) % 100) <= 99))
  20. {
  21. if ((((egn / 1000000) % 100) >= 1) && (((egn / 1000000) % 100) <= 12))
  22. {
  23. if ((((egn / 10000) % 100) >= 1) && (((egn / 10000) % 100) <= 31))
  24. {
  25. Console.WriteLine("Correct");
  26. isTrue=false;
  27. }
  28.  
  29. }
  30. }
  31. }
  32. else
  33. {
  34. Console.WriteLine("Incorrect, try again!");
  35. isTrue = true;
  36. }
  37. }
  38.  
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement