Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication16
- {
- class Program
- {
- static string EGN;
- static bool IsLengthValid(string EGN)
- {
- if (EGN.Length != 10)
- {
- return false;
- }
- foreach (char c in EGN)
- {
- if (Char.IsLetter(c))
- {
- return false;
- }
- }
- return true;
- }
- public static bool isMonthValid(month1, month2)
- {
- Console.WriteLine("EGN[2]=" + EGN[3]);
- string month = ((EGN.Substring(2, 1)));
- month1 = int.Parse(Console.ReadLine());
- if (month1!=0 && month1!=1)
- {
- return false;
- }
- return true;
- }
- static void Main(string[] args)
- {
- do
- {
- Console.WriteLine("Enter your EGN: ");
- string EGN = Console.ReadLine();
- Console.WriteLine("And it returns:" + isMonthValid(EGN));
- if (isMonthValid(EGN))
- {
- Console.WriteLine("EGN is valid!");
- }
- else
- {
- Console.WriteLine("This is not a valid EGN.");
- }
- }
- while (true);
- }
- }
- }
- /*public static bool (month1, month2)
- if(month1!=0 && month1!=1)
- {
- return false
- }
- if (month2<0 || month2>9)
- {
- return false;
- }
- //(4,2)
- //Vzimame 4etvyurtiq simvol if ot nego broim 2 simvola
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement