Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Pocetok {
- public static void main(String[] args) {
- String s = new String();
- s = "XYZ";
- int x = 3;
- for(int i = 0; i < s.length(); i++) {
- int alphabet_position = (s.charAt(i) - 'A');
- int ceaser = (alphabet_position + x) % 26;
- char cipher = (char) (ceaser + 'A');
- System.out.println(s.charAt(i) + " " + cipher);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement