All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
print 'print 'print 'print ... (Posted on 2003-09-19) Difficulty: 5 of 5
Write a program that prints itself.

See The Solution Submitted by DJ    
Rating: 4.6875 (16 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution SOLUTION (2) - Not Mine | Comment 2 of 32 |
main(){char*a="main(){char*a=%c%s%c;printf(a,34,a,34);}";printf(a,34,a,34);}

This is pretty cute too... and probably more to the spirit of what DJ is looking for.
(Although scripting languages that can easily deal with the file containing the source make the problem trivial, as my previous solution demonstrates).

I found this solution at:
http://www.its.caltech.edu/~boozer/symbols/programs.html

--- SK
  Posted by SilverKnight on 2003-09-19 13:45:13
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information