import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        System.out.print("Enter a message: ");
        String text = sc.nextLine();
        
        System.out.print("Enter shift value: ");
        int shift = sc.nextInt();
        
        String result = "";
        
        for (int i = 0; i < text.length(); i++) {
            char ch = text.charAt(i);
            
            if (ch >= 'a' && ch <= 'z') {
                char newChar = (char)((ch - 'a' + shift) % 26 + 'a');
                result = result + newChar;
            } 
            else if (ch >= 'A' && ch <= 'Z') {
                char newChar = (char)((ch - 'A' + shift) % 26 + 'A');
                result = result + newChar;
            } 
            else {
                result = result + ch;
            }
        }
        
        System.out.println("Encrypted message: " + result);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: