SHARE
TWEET

Untitled

krasi1105 Mar 3rd, 2017 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace colors
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             ConsoleColor[] colors = AllColors();
  14.             string name = Console.ReadLine();
  15.             Random r = new Random();
  16.             for (int i = 0; i < name.Length; i++)
  17.             {
  18.                 Console.ForegroundColor = colors[r.Next(16)];
  19.                 Console.Write(name[i]);
  20.             }
  21.             Console.ForegroundColor = ConsoleColor.White;
  22.             Console.WriteLine();
  23.         }
  24.  
  25.         private static ConsoleColor[] AllColors()
  26.         {
  27.             ConsoleColor[] colors = new ConsoleColor[16];
  28.             colors[0] = ConsoleColor.Black;
  29.             colors[1] = ConsoleColor.Blue;
  30.             colors[2] = ConsoleColor.Cyan;
  31.             colors[3] = ConsoleColor.DarkBlue;
  32.             colors[4] = ConsoleColor.DarkCyan;
  33.             colors[5] = ConsoleColor.DarkGray;
  34.             colors[6] = ConsoleColor.DarkGreen;
  35.             colors[7] = ConsoleColor.DarkMagenta;
  36.             colors[8] = ConsoleColor.DarkRed;
  37.             colors[9] = ConsoleColor.DarkYellow;
  38.             colors[10] = ConsoleColor.Gray;
  39.             colors[11] = ConsoleColor.Green;
  40.             colors[12] = ConsoleColor.Magenta;
  41.             colors[13] = ConsoleColor.Red;
  42.             colors[14] = ConsoleColor.White;
  43.             colors[15] = ConsoleColor.Yellow;
  44.             return colors;
  45.         }
  46.     }
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top