Advertisement
Josif_tepe

Untitled

Oct 24th, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Pocetok {
  4.     public static void main(String[] args) {
  5.       String s = new String();
  6.       s = "XYZ";
  7.       int x = 3;
  8.      for(int i = 0; i < s.length(); i++) {
  9.          int alphabet_position = (s.charAt(i) - 'A');
  10.          int ceaser = (alphabet_position + x) % 26;
  11.         char cipher = (char) (ceaser + 'A');
  12.          System.out.println(s.charAt(i) + " " + cipher);
  13.      }
  14.     }
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement