Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Loop
- {
- class ForEachLoop
- {
- public static void Main(string[] args)
- {
- //за да работи програмата, годините трябва да са м-у (40-99), месеците(1-12), дните(1=31), иначе ше иска ново въвеюдане, докато не се получи правилното егн..
- bool isTrue = true;
- while (isTrue)
- {
- long egn = long.Parse(Console.ReadLine());
- if (egn.ToString().Length == 10)
- {
- if ((((egn / 100000000) % 100) >= 40) && (((egn / 100000000) % 100) <= 99))
- {
- if ((((egn / 1000000) % 100) >= 1) && (((egn / 1000000) % 100) <= 12))
- {
- if ((((egn / 10000) % 100) >= 1) && (((egn / 10000) % 100) <= 31))
- {
- Console.WriteLine("Correct");
- isTrue=false;
- }
- }
- }
- }
- else
- {
- Console.WriteLine("Incorrect, try again!");
- isTrue = true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement