# Introduction

Every letter in the English alphabet can be represented as an ASCII code. For example, a is 97, and S is 83. As we all know, the formula for averaging two numbers $$\x\$$ and $$\y\$$ is $$\\frac{x+y}{2}\$$. I'm pretty sure you can see where this is going. Your challenge is to average two letters.

# Challenge

Your program must take two letters as input, and output the average of the ASCII values in it. If the average is a decimal, you should truncate it.

• Input will always be two ASCII letters. You can assume they will always be valid, but the case may vary. Basically, both letters will be in the range 97-122 or 65-90. The second letter will always have a greater ASCII value than the first. If your language has no method of input, you may take input from command line arguments or from a variable.
• You must output the ASCII character signified by the average of the two numbers. As stated above, it should always be truncated to 0 decimal places. If your language has no method of output, you may store it in a variable. Exit codes and return values are considered valid output methods.

# Example I/O

• Input: A, C
Output: B
• Input: a, z
Output: m
• Input: d, j
Output: g
• Input: B, e
Output: S
• Input: Z, a
Output: ]

# Rules

This is , so shortest answer in bytes wins!

• Please specify whether, for example, B e is a valid input. Commented Nov 10, 2019 at 19:53
• Why is the output of the last example U? The value of B is 66 and the value of e is 101, which averages to 83.5, truncated to 83, which corresponds to S Commented Nov 10, 2019 at 23:05
• If that example is correct, it will invalidate all of the existing answers.
– user85052
Commented Nov 11, 2019 at 10:05
• Sorry. I read an ASCII table wrong and got 69 for B, not 66. Commented Nov 11, 2019 at 14:00
• Could I enter for a non-ASCII compliant system? Commented Nov 25, 2019 at 17:28

# Ruby, 45 bytes

a,b=gets.split;puts"#{((a.ord+b.ord)/2).chr}"


Attempt This Online!

• 32 bytes taking input separated by newlines Commented Apr 9, 2022 at 20:48

# J-uby, 22 bytes

:*&:ord|+:+|~:/&2|:chr


Attempt This Online!

## Explanation

:* & :ord | +:+ | ~:/ & 2 | :chr

:* & :ord |                       # Map with .ord, then
+:+ |                 # sum, then
~:/ & 2 |       # integer divide by two, then
:chr  # convert to character


# Uiua, 18 bytes

⍜∩utf(⌊÷2+)


Try It

Explanation

⍜∩utf(⌊÷2+)
⍜∩utf # convert both chars to ints,
# apply the operation in parentheses, and undo the char to int conversion
(⌊÷2+) # calculate a floored avg
+ # sum both elements
÷2 # divide by two
⌊ # floor the result