Advertisement
D_Corriher

WebAddress.cs

Apr 3rd, 2020
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace WebAddess.cs
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string webadress = "";
  14.             int lcv = 1;
  15.             while (lcv < 5)
  16.             {
  17.                 Console.Write("Enter a web address: ");
  18.                 webadress = Console.ReadLine();
  19.                 if(webadress.All(char.IsLetterOrDigit))
  20.                 {
  21.                     webadress = webadress.Replace(" ", "");
  22.                     Console.WriteLine("Web address is valid");
  23.                     break;
  24.                 }
  25.                 else
  26.                 {
  27.                     Console.WriteLine("Web address invalid.");
  28.                 }
  29.             }
  30.             Console.WriteLine("Your web address is: \n" +
  31.                 "www." + webadress + ".com");
  32.             Console.ReadLine();
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement