Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Short program made in C# that ramdomize a phrase you input between lower case and uppercase.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Randomizer
- {
- class Program
- {
- static void Main(string[] args)
- {//declaring variables
- string userInput;
- //Printing text and storing user input in variable.
- Console.WriteLine("Please introduce a sentence to randomize");
- userInput = Console.ReadLine();
- //Ramdomize user's input
- for (int i = 0; i < userInput.Length; i++)
- {
- Random rnd = new Random();
- int coinFlip = rnd.Next(2);
- if (coinFlip == 0)
- {
- //Print user's new randomized input
- Console.WriteLine($"{userInput.ToUpper()[i]}");
- }
- else if (coinFlip == 1)
- {
- //Print user's new randomized input
- Console.WriteLine($"{userInput.ToLower()[i]}");
- }
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement