Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication21
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Would you like to encrypt or decrypt a string?");
- string Choice = Console.ReadLine().ToLower();
- if (Choice[0] == 'e')
- {
- string Stnew = "";
- Console.WriteLine("Input a string");
- string St = Console.ReadLine().ToLower();
- for (int i = 0; i < St.Length; ++i)
- {
- if (St[i] != 'z')
- {
- Stnew += (char)(St[i] + 1);
- }
- else
- {
- Stnew += 'a';
- }
- }
- Console.WriteLine(Stnew);
- }
- else
- {
- string Stnew = "";
- Console.WriteLine("Input a string");
- string St = Console.ReadLine().ToLower();
- for (int i = 0; i < St.Length; ++i)
- {
- if (St[i] != 'a')
- {
- Stnew += (char)(St[i] - 1);
- }
- else
- {
- Stnew += 'z';
- }
- }
- Console.WriteLine(Stnew);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment