You are on page 1of 1
1. Suppose that each letter in the alphabet corresponds to an integer, 1, Be2 .. Y=25, 6) Create a program that will ask for two letter inputs (regardless in this case, its precedence in the alphabet (i.e. 2 of their case), add these two letters and return a value which maps to another letter. In case of adding letters with a sum above 26 (i.e. Z+Z, [26+26]) the sum should be subtracted by 26, carry a letter A, and return another letter which is equivalent to the difference. Input #1: firstLetter: G secondLetter: K G+KisR +G=7, K=11-->74+11=18-R Input #2: firstLetter: N secondLetter: x N+X is AL N = 14, X = 24 --> 14 + 24 = 38, since there is no letter corresponding to 38, subtract 26 from it (we only have 26 letters) leaving us with 12 carry 1. Since 1 = A and 12 = L therefore, the answer is AL.

You might also like