2009-04-27, 07:43 PM
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:
I've only found one, but I'm stupid
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.
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

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.

