Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dataTypesAndVariablesExerciseMoreExercise;
- import java.util.Scanner;
- public class DecryptingMessages {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- byte key = Byte.parseByte(scan.nextLine());
- byte n = Byte.parseByte(scan.nextLine());
- for (int i = 0; i < n; i++) {
- char currentSymbol = scan.nextLine().charAt(0);
- int representation = (int)currentSymbol;
- int decryption = representation+key;
- char symbol = (char)decryption;
- System.out.print(symbol);
- }
- }
- }
Add Comment
Please, Sign In to add comment