Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApplication16
  4. {
  5. class Program
  6. {
  7.  
  8. static string EGN;
  9.  
  10. static bool IsLengthValid(string EGN)
  11. {
  12. if (EGN.Length != 10)
  13. {
  14. return false;
  15. }
  16. foreach (char c in EGN)
  17. {
  18. if (Char.IsLetter(c))
  19. {
  20. return false;
  21. }
  22. }
  23. return true;
  24. }
  25.  
  26. public static bool isMonthValid(month1, month2)
  27. {
  28. Console.WriteLine("EGN[2]=" + EGN[3]);
  29. string month = ((EGN.Substring(2, 1)));
  30. month1 = int.Parse(Console.ReadLine());
  31. if (month1!=0 && month1!=1)
  32. {
  33. return false;
  34. }
  35. return true;
  36. }
  37.  
  38.  
  39. static void Main(string[] args)
  40. {
  41. do
  42. {
  43. Console.WriteLine("Enter your EGN: ");
  44. string EGN = Console.ReadLine();
  45. Console.WriteLine("And it returns:" + isMonthValid(EGN));
  46. if (isMonthValid(EGN))
  47. {
  48. Console.WriteLine("EGN is valid!");
  49. }
  50. else
  51. {
  52. Console.WriteLine("This is not a valid EGN.");
  53. }
  54. }
  55. while (true);
  56. }
  57. }
  58. }
  59.  
  60.  
  61. /*public static bool (month1, month2)
  62. if(month1!=0 && month1!=1)
  63. {
  64. return false
  65. }
  66. if (month2<0 || month2>9)
  67. {
  68. return false;
  69. }
  70.  
  71.  
  72. //(4,2)
  73. //Vzimame 4etvyurtiq simvol if ot nego broim 2 simvola
  74. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement