g | x | w | all
Bytes Lang Time Link
027AWK250729T152729Zxrs
007Uiua241123T191747ZErikDaPa
014HP‑41C series241123T063007ZKai Burg
004MATL171128T102513ZStewie G
018PowerShell181227T153752ZGMills
017Powershell 6181227T194128Zmazzy
002Japt180512T072243ZShaggy
050brainfuck171128T060927ZJo King
031Tcl180410T173302Zsergiol
010Hexagony180320T134949ZAdyrem
016FORTH 16 BYTES180320T132021Zpanicmor
030Fortran GFortran180320T131057Zrafa1111
011Haskell180320T110044ZLaikoni
015Java 8180320T103210ZKevin Cr
038Haskell140219T193629ZChristop
020Perl120919T063328ZkSiR
006Befunge93171128T055735ZJo King
107Brainfuck120918T005732Zdspyz
018SmileBASIC180317T005638Z12Me21
003Pyth 3 Bytes171128T161002ZTornado5
004Husk180317T000656ZSophia L
003Jelly180316T221052Zcaird co
006Ly180316T215027Zweatherm
017PHP171128T081458ZTitus
066BrainFuck171128T041440Zl4m2
034TIBasic171128T024059ZTimtech
009Python 2120914T172654ZMatt
030Tcl171128T022408Zsergiol
087C#140219T211938ZRobIII
nanC# 4140219T192804ZPauloHDS
014Classic ASP140219T192008ZToothbru
007GolfScript120917T231843Zanon
025Javascript120918T203239ZClyde Lo
442PHP120918T203228Zscleaver
011R120915T061528ZPaolo
004APL120915T011333Zmarinus
006DC120914T230533Zdaniero
007J120914T082713ZGareth
006Burlesque120914T071728Zmroman
010Ruby 1.9120914T035542ZPaul Pre
007q/k120914T030625Zskeevey

AWK, 27 bytes

@load"ordchr";$0=chr($1+64)

Attempt This Online!

Uiua, 7 bytes

+@@⋕&sc

Explanation:

+@@⋕&sc
    &sc => user input
   ⋕    => parse as number
+@@     => add 64 and convert to corresponding ascii character (@ = 64)

Try this online!

HP‑41C series, 14 Bytes

The alphanumeric liquid crystal display of the HP‑41C pocket calculators can display all modern English alphabet capital letters and a couple lower‐case letters as well. Clear the contents of the α‑register (CLα), place the number on top of the stack (the X register) and XEQ (execute) the program:

01♦LBL⸆Z           5 Bytes    global label requires 4 + n Bytes
02 64              2 Bytes    Y ≔ X; X ≔ 64
03 +               1 Byte     X ≔ X + 64
04 XTOA            2 Bytes    turn value into character and append to α‑register
05 AVIEW           1 Byte     display (and perhaps print) contents of α‑register
06 END             3 Bytes    terminate program execution

The HP‑41C uses a coded character set that is largely identical to ASCII (but not entirely). The capital letter A has the numeric value 65. For 1‑based indexing we add 64 to the given value.

MATL, 4 bytes

64+c

Try it online!

Because, why not. Takes input implicitly, pushes 64 and adds it to the input number. Finally it converts the number to its ASCII-equivalent using c.

PowerShell, 19 18 bytes

-1 byte thanks to @mazzy lol
I don't think it'll get much shorter than this.

[char](64+"$args")

Try it online!

Takes input from a command line argument.

Powershell 6, 17 bytes

('@'..'Z')[$args]

Japt, 2 bytes

dI

Try it or test all numbers

brainfuck, 64 56 50 bytes

Thanks to Dorian for saving 3 bytes and inspiring 3 more

,>,[<+[-<+>[-<]>>]<[<++<-]>++>>]<<+++[->+++++<]>+.

Try it online!

How it works

,>, Gets input
   [ if a two digit number
    <+[-<+>[-<]>>] Gets modulo 2 of first number plus 1
                  <[<++<-] Sets the fives cell to 2 if the first number is a 2
                          >++ Adds another 2 to the fives cell
                             >>]  Moves to cell after ones cell
                                <<+++ Adds 3 to fives cell
                                     [->+++++<] Multiply the fives cell by 5 and add it to the ones cell
                                               >+.  Add one and print

Tcl, 31 bytes

puts [format %c [incr argv 64]]

Try it online!

Hexagony, 10 Bytes

Try it online!

A({/'+;?/@

Expanded:

  A ( {
 / ' + ;
? / @ . .
 . . . .
  . . .

This honestly took me way longer than it should have, as it's just 2 simple reflections.


The simplest version for this problem is only 2 bytes longer

  A ( {
 . . . .
? ' + ; @
 . . . .
  . . .

FORTH 16 BYTES

: n 64 + EMIT ;

OUTPUT:

8 N
8 N H ok
5 N
5 N E ok
12 N
12 N L ok
12 N
12 N L ok
15 N
15 N O ok
23 N
23 N W ok
15 N
15 N O ok
18 N
18 N R ok
12 N
12 N L ok
4 N
4 N D ok

Fortran (GFortran), 30 bytes

READ*,I
PRINT*,ACHAR(I+64)
END

My entry in the good ol' Fortran.

Try it online!

Haskell, 11 bytes

(['@'..]!!)

Try it online! This anonymous function indexes into the string "@ABCDEFG ...".

Java 8, 15 bytes (as lambda function)

n->(char)(n+64)

Try it online.

Java 8, 84 bytes (as full program)

interface M{static void main(String[]a){System.out.printf("%c",new Byte(a[0])+64);}}

Try it online.

Haskell, 38 bytes

main = putChar $ ('a':['a'..'z']) !! c

Where c is the number.

Perl, 20 characters

chr(($ARGV[0] + 64))

Verification :

risk@skynet:~/perl$ for x in {1..26}; do perl ./ord.pl $x; done;
ABCDEFGHIJKLMNOPQRSTUVWXYZrisk@skynet:~/perl$

Befunge-93, 7 6 bytes

"&++,@

Try it online!

Takes advantage of the extra spaces at the end of a wrapping string literal by adding two spaces (32*2 = 64) to the inputted number to turn it into the corresponding alphabetic character. Funnily enough, if we use a implementation that doesn’t include the wrapping spaces, we can do "&+.@ to add the @ (64) to the number instead.

Brainfuck, 107 bytes

>,----------[>++++++[-<------>],----------]<[<]>>[<--[->++++++++++<]>>]+++++++[-<+++++++++>]<-.>++++++++++.

SmileBASIC, 18 bytes

INPUT N?CHR$(N+64)

Pyth - 5 3 Bytes

@Gt

Saved two bytes thanks to ovs

Completely forgot about t and implicit Q

Explanation:

@    Index
 G   in alphabet of
  t  one less than
   Q Input (implicitly added to solve arity)
  

Husk, 4 bytes

c+64

Try it online!

Boring, but probably optimal. Adds 64 to the given number and converts it to ASCII. !¡→'A is cuter (awww, the exclamation marks are friends!) but one byte longer.

Jelly, 3 bytes

ịØA

Try it online!

Ly, 6 bytes

n8:*+o

Try it online!

PHP, 17 bytes

<?=chr(64+$argn);

Run s pipe with -F

BrainFuck, 66

,>,----------[<[->++++++++++<]++++++[>+++++++<-]>>]++++[<++++>-]<.

TI-Basic, 34 bytes

sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ans,1

This is as short as it gets...

Python 2, 9 bytes

chr(64+x)

Or, reading from stdin and printing to stdout: 21

print chr(64+input())

Tcl, 30 bytes

puts [expr [scan $argv %c]-64]

Try it online!

C#, 87

class P{static void Main(string[]a){System.Console.Write((char)(int.Parse(a[0])+64));}}

Complete program (not some (part of a) "function" expecting foo to be bar to work), accepts command line parameter: foo.exe 1 prints A, foo.exe 16 prints P

C#, 10

When I make the same assumptions as, for example, the 'code-golfers' that posted the VSCript Classic ASP, Python, Burlesque, Ruby, C solutions we can get it down to 10:

(char)x+64

"Assuming x is magically initialized / passed in / on the stack / whatever excuse" and the contest doesn't explicitly require me to print it, just "return" it (which most of the above solutions don't do, either).

C# 4,50KB (196 characters)

My first time here =)

using System; namespace W { class P { static void Main(string[] args) {
            Console.WriteLine(" abcdefghijklmnopqrstuvwxyz".ToCharArray()[int.Parse(Console.ReadLine())]);
        }
    }
}

Classic ASP (14 bytes):

<%=Chr(c+64)%>

Expects c to hold the character number.

GolfScript, 7

64+]''+

Commentary

64    # corresponds to '@' in ASCII (65 is 'A')
+]    # add the input to 64. ']' is used for ASCII.
''+   # the conversion process

1 corresponds to A

26 corresponds to Z

Javascript, 25 chars

String.fromCharCode(66-x);

PHP, 22 chars

echo chr(66-$argv[0])

PHP 442

$alphabet = Array('A' => 1,'B' => 2,'C' => 3,'D' => 4,'E' => 5,'F' => 6,'G' => 7,'H' => 8,
'I' => 9,'J' => 10,'K' => 11,'L' => 12,'M' => 13,'N' => 14,'O' => 15,'P' => 16,'Q' => 17,
'R' => 18,'S' => 19,'T' => 20,'U' => 21,'V' => 22,'W' => 23,'X' => 24,'Y' => 25,'Z' => 26
)

function testInputForAlphabetCharacter($input){
    for($index = 0; $index < count($alphabet); $i = $i + 1){
        if($alphabet[$index] == $input){
            echo($index);
        }
    }
}


$input = $_GET['input'];
testInputForAlphabetCharacter($input);

R, 11 characters

LETTERS[x]

Usage:

LETTERS[21]
[1] "U"

APL (4)

(Full program)

⎕⌷⎕A

Explanation:

(user input) (index) ⎕A (alphabet)

(They're supposed to be boxes, it's not an encoding problem.)

DC - 6 characters

Full program including input and output.

?64+af

save to file and run with $ dc file

J, 7 characters

a.{~64+

Usage:

   a.{~64+1
A

Burlesque (6 characters)

Assuming the number is already on the stack:

64.+L[
(see here in action.).

Does the usual: Add 64, convert to character based on ASCII value.

If number is supplied as a string via stdin to stdout (10 characters):

ri64.+L[sh

Alternative version without using ASCII value conversion:

'@'Zr@\/!!

Ruby 1.9 (10)

(x+64).chr

Reading from STDIN and printing to STDOUT:

$><<(gets.to_i+64).chr

q/k (7)

As partially applied composition:

10h$64+