Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 09.Caesar Cipher
- Write a program that returns an encrypted version of the same text. Encrypt the text by shifting each character with three positions forward. For example A would be replaced by D, B would become E, and so on. Print the encrypted text.
- Examples
- Input Output
- Programming is cool! Surjudpplqj#lv#frro$
- One year has 365 days. Rqh#|hdu#kdv#698#gd|v1
- using System;
- public class Program
- {
- public static void Main()
- {
- var text = Console.ReadLine();
- var encryptedText = "";
- for (int i = 0; i < text.Length; i++)
- {
- encryptedText += (char)(text[i] + 3);
- }
- Console.WriteLine(encryptedText);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment