Linked Questions

-2 votes
1 answer

BF Last binary digit [duplicate]

Task Your task is to write as short as possible program preferably in Brainf**k which determines the last digit of given number after it's conversion from decimal to binary system. Input An integer ...
jean's user avatar
  • 485
522 votes
985 answers

"Hello, World!"

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
Martin Ender's user avatar
244 votes
456 answers

Golf you a quine for great good!

Using your language of choice, golf a quine. A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output. No cheating -- that means ...
Rafe Kettler's user avatar
  • 2,717
236 votes
369 answers

Is this number a prime?

Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in ...
Dennis's user avatar
  • 210k
145 votes
570 answers

Shortest infinite loop producing no output

Your task is to create the shortest infinite loop! The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code ...
user41805's user avatar
  • 13.1k
196 votes
416 answers

1, 2, Fizz, 4, Buzz

Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other ...
Beta Decay's user avatar
  • 23.4k
276 votes
141 answers

I need a program where the user inputs an array of doubles and the program outputs the array sorted

Note: This question was severely edited since I first posted it here. The rules were moved to here, read them before posting any answer to understand the purpose of this. This was the first question ...
Victor Stafusa's user avatar
112 votes
330 answers

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 named after ...
Martin Ender's user avatar
68 votes
235 answers

Add two numbers

Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list. ...
anna328p's user avatar
  • 6,396
390 votes
36 answers

American Gothic in the palette of Mona Lisa: Rearrange the pixels

You are given two true color images, the Source and the Palette. They do not necessarily have the same dimensions but it is guaranteed that their areas are the same, i.e. they have the same number of ...
Calvin's Hobbies's user avatar
167 votes
66 answers

Tips for golfing in C

What general tips do you have for golfing in C? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C (e.g. "remove comments" is not an ...
Casey's user avatar
  • 3,609
106 votes
39 answers

Tips for golfing in Java

Are there any useful shortcuts that can be used in Java? As shown below, import already adds at least 17 characters to a program. ...
user avatar
34 votes
90 answers


Task Given a non-negative number, check if it's odd or even. In case it's even, output that number. Otherwise, throw any exception/error that your language supports, and stop the program. Example with ...
LeopardL GD's user avatar
31 votes
79 answers

Sum the numbers on standard in

Consider a stream/file with one integer per line. For example: 123 5 99 Your code should output the sum of these numbers, that is ...
user avatar
33 votes
63 answers

The Squiggly Sequence

All credits to Adnan for coming up with this challenge. My last challenge, before I go on break. Task Given positive integer n, if ...
Leaky Nun's user avatar
  • 49.8k

15 30 50 per page