Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Print the alphabet using alphabetic source

+1
−0

The task is to write a program that takes no input and prints the English alphabet in upper-case letters. It can be printed either as a single line ABCDEFGHIJKLMNOPQRSTUVWXYZ, or as letters separated by spaces, or as letters separated by new line.

This is code golf, so the shortest program in each programming language wins. However, there are special rules for this challenge:

  • The source code must be formatted in multiple lines, 26 in total.
  • The first letter symbol encountered on each line in the source must correspond to a letter in the alphabet, upper or lower case, and they must be placed in alphabetic order. So the first letter found on the first line must be A or a, the first letter on the next line must be B or b and so on.
  • Only the first letter encountered on that line counts as the letter for that line.
  • Other symbols that are not letters A to Z may occur anywhere.
  • The source may not contain comments.
  • Only complete stand-alone programs are accepted, not function solutions.

Example of an accepted program in standard C:

_Atomic int a=0x\
B\
C;
#define j int
extern char*
f=
"G"
"H";
#include <stdio.h>
j main (void){
k:;
long 
m,
n,
o;
puts("ABCDEFGHIJKLMNOP"
"Q"
"R"
"S"
"T"
"U"
"V"
"W"
"X"
"Y"
"Z");}

Try it online!

Output

ABCDEFGHIJKLMNOPQRSTUVWXYZ
History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

General comments (12 comments)