Advertisement
Guest User

14

a guest
Dec 8th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace TFYA_lab14
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string pattern = @"\b\d+[A-F]*((\d*)|([A-F]*))*\b";
  15.             Console.WriteLine("Введите шеснадцатиричное число");
  16.             string number = Console.ReadLine();
  17.             if(Regex.IsMatch(number,pattern,RegexOptions.IgnoreCase))
  18.             {
  19.                 Console.WriteLine("Число введено верно");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine("Число введено неверно");
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement