Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CaesarCipher_04 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String text = scanner.nextLine(); //"Programming is cool!"
- StringBuilder encryptedText = new StringBuilder();
- for (int position = 0; position <= text.length() - 1; position++) {
- char symbol = text.charAt(position);
- char encryptSymbol = (char)(symbol + 3);
- encryptedText.append(encryptSymbol);
- }
- System.out.println(encryptedText);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement