Advertisement
notjacob

java developer makes a C# program (colorized)

Feb 28th, 2020
124
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.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4. public class Program
  5. {
  6.     private static readonly Regex regex = new Regex(@"^\d+$");
  7.     public static void Main()
  8.     {
  9.         List<String> toSend = new List<String>();
  10.         String ae = "";
  11.         Console.WriteLine("Enter a number!!!! (!!!)");
  12.         String a = Console.ReadLine();
  13.         if (!regex.IsMatch(a)) {
  14.             Console.WriteLine("That isnt a number!");
  15.             return;
  16.         }
  17.         int b = Int32.Parse(a);
  18.         Console.WriteLine("You specified: " + a + " a's! I will now print them!");
  19.         for (int i = 0; i < b; i++) {
  20.             toSend.Add("a");   
  21.         }
  22.         ae += "[";
  23.         foreach (String s in toSend) {
  24.                 ae+="\"a\", ";
  25.         }
  26.         ae = ae.Substring(0, ae.LastIndexOf(","));
  27.         ae += "]";
  28.         Console.WriteLine(ae + "\nDone!!!!!!!!!!!!!");
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement