Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Puzzle (coding)
#1
from XKCD wiki thingy

Find three ways to make the C program below print 20 copies of the dash character '-' by changing/adding one character:

Code:
int i, n = 20;
for (i = 0; i < n; i--)
{
    printf("-");
}

I've only found one, but I'm stupid Rolleyes

Spoilerplz.

Also:
* Find a way to get it to print exactly 21 dashes (changing 1 character).
* Find a way to get it to print exactly 1 dash (changing one character).
* Print 20 dashes with the given code, without changing it at all, but adding some preceding code.
* Print 1 dash with the given code, without changing it at all, but adding some preceding code.
Reply


Messages In This Thread
Puzzle (coding) - by Russt - 2009-04-27, 07:43 PM
Puzzle (coding) - by XTOTHEL - 2009-04-27, 09:03 PM
Puzzle (coding) - by Russt - 2009-04-29, 08:23 PM
Puzzle (coding) - by Dusk - 2009-04-29, 08:40 PM
Puzzle (coding) - by Morgana - 2009-04-29, 09:02 PM
Puzzle (coding) - by Heidi - 2009-04-29, 09:20 PM
Puzzle (coding) - by Morgana - 2009-04-29, 09:25 PM
Puzzle (coding) - by Heidi - 2009-04-29, 09:37 PM
Puzzle (coding) - by Russt - 2009-04-29, 11:06 PM
Puzzle (coding) - by Morgana - 2009-04-29, 11:20 PM
Puzzle (coding) - by Cactuar - 2009-04-30, 12:04 AM
Puzzle (coding) - by KajitiSouls - 2009-04-30, 01:21 AM
Puzzle (coding) - by Russt - 2009-05-01, 03:48 AM
Puzzle (coding) - by GummyBear - 2009-05-02, 05:53 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)