TheBulgarianWolf

Caesar Cipher

Mar 19th, 2021
583
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Text;
  3.  
  4. namespace CaesarCipher
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.WriteLine("Enter your string here: ");
  11.             string input = Console.ReadLine();
  12.             StringBuilder sb = new StringBuilder("");
  13.             foreach(char ch in input)
  14.             {
  15.                 int code = (int)ch + 3;
  16.                 char newOne = (char)code;
  17.                 sb.Append(newOne);
  18.             }
  19.  
  20.             Console.WriteLine(sb);
  21.         }
  22.     }
  23. }
  24.  
RAW Paste Data