A friend sent me this riddle (which I imagine isn't his, but nevermind) via mail, and I thought it cute enough to share:
Find three ways to change/insert/delete a single character in the following code, so that the resulting code will print 20 star characters (*). Remember, for each solution you can only change one character, and there are at least three different solutions.#include <stdio.h> int main() { int i, N = 20; for ( i = 0 ; i < N ; i-- ) printf( "*" ); return 0; }
Find three ways to change/insert/delete a single character in the following code, so that the resulting code will print 20 star characters (*). Remember, for each solution you can only change one character, and there are at least three different solutions.
#include <stdio.h> int main() { int i, N = 20; for ( i = 0 ; i < N ; i-- ) printf( "*" ); return 0; }
I'll post the solution in a few days, feel free to yell "eureka" in the comment section or whatever.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u
© Copyright 2008 Tomer Gabel Based on theme design by Bryan Bell | | Powered by newtelligence dasBlog 2.0.7226.0 |  Page rendered at Sunday, October 12, 2008 2:53:04 PM (Jerusalem Standard Time, UTC+02:00)