Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Char_rotation
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] chars = Console.ReadLine().ToCharArray();
- string[] input = Console.ReadLine().Split(' ');
- int[] numbers = new int[input.Length];
- string output = string.Empty;
- for (int i = 0; i < numbers.Length; i++)
- {
- numbers[i] = int.Parse(input[i]);
- if (numbers[i] % 2 == 0)
- {
- int ASCIICode = chars[i];
- output += (char)(ASCIICode - numbers[i]);
- }
- else if (numbers[i] % 2 != 0)
- {
- int ASCIICode = chars[i];
- output += (char)(ASCIICode + numbers[i]);
- }
- }
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement