Linked Questions
112 questions linked to/from Tips for golfing in C
112
votes
336
answers
22k
views
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is ...
81
votes
264
answers
25k
views
Is this even or odd?
Note: There is not been a vanilla parity test challenge yet (There is a C/C++ one but that disallows the ability to use languages other than C/C++, and other non-vanilla ones are mostly closed too), ...
92
votes
217
answers
23k
views
Find the Factorial!
Create the shortest program or function that finds the factorial of a non-negative integer.
The factorial, represented with ! is defined as such
$$n!:=\begin{...
173
votes
98
answers
70k
views
Tips for golfing in JavaScript
What general tips do you have for golfing in JavaScript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to JavaScript (e.g. "remove ...
85
votes
222
answers
17k
views
Sum of all integers from 1 to n
I'm honestly surprised that this hasn't been done already. If you can find an existing thread, by all means mark this as a duplicate or let me know.
Input
Your input is in the form of any positive ...
96
votes
170
answers
14k
views
Determine whether strings are anagrams
Challenge
Given two strings, work out if they both have exactly the same characters in them.
Example
Input
word, wrdo
This returns true because they are the ...
74
votes
173
answers
17k
views
Print 0 to 100 without 1-9 characters
Print integers 0 to 100 (inclusive) without using characters 123456789 in your code.
Separator of numbers can be comma or white space (by default <blank>, <...
74
votes
164
answers
19k
views
The alphabet in programming languages
Our task is to, for each letter of the (English) alphabet, write a program that prints the alphabet, in a language whose name starts with that letter.
Input: none
Output:
...
64
votes
153
answers
13k
views
Draw an asterisk triangle
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).
Input:
A positive integer n >= 1.
Output:
...
74
votes
141
answers
12k
views
Make a ;# interpreter
I recently created a new language called ;# (pronounced "Semicolon Hash") which only has two commands:
; add one to ...
68
votes
140
answers
12k
views
Reverse stdin and place on stdout
Requirements:
Take an input on stdin including new lines / carriage returns of unlimited length (only bounded by system memory; that is, there is no inherent limit in the program.)
Output the reverse ...
69
votes
130
answers
9k
views
Print/Output the L-phabet
Inspired by George Gibson's Print a Tabula Recta.
You are to print/output this exact text:
...
55
votes
164
answers
11k
views
Stay away from zero
Task
Given a non-negative integer n, output 1 if n is 0,...
57
votes
137
answers
19k
views
Is this number evil?
Introduction
In number theory, a number is considered evil if there are an even number of 1's in its binary representation. In today's challenge, you will be identifying whether or not a given number ...
47
votes
148
answers
6k
views
Full Width Text
Full width text is text that has a space after every character, including the last one. For instance, the first sentence of this question becomes:
...