Advertisement
Dimitar_Milenkov

Untitled

Jan 30th, 2023
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MyApp
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. {
  10. int key = int.Parse(Console.ReadLine());
  11. int n = int.Parse(Console.ReadLine());
  12.  
  13. for (int i = 0; i < n; i++)
  14. {
  15. char input = char.Parse(Console.ReadLine());
  16.  
  17. int shifted = (int)input + key;
  18. if ((int)input >= 65 & (int)input <= 90)
  19. {
  20. if (shifted > 90)
  21. {
  22. shifted = 65 + shifted - 91;
  23. }
  24. }
  25. else if ((int)input >= 97 && (int)input <= 122)
  26. {
  27. if (shifted > 122)
  28. {
  29. shifted = 97 + shifted - 123;
  30. }
  31. }
  32.  
  33. Console.Write((char)shifted);
  34. }
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement