In computing, a quine is a computer program which produces a copy of its own source code as its only output.
python # adapted from a Quine by Sean B. Palmer
print (lambda s='print (lambda s=%r: (s %% s))()': (s % s))()
# adapted from a Quine by Sean B. Palmer
print (lambda s='print (lambda s=%r: (s %% s))()': (s % s))()
python x='x=%r;print(x%%x)';print(x%x)
x='x=%r;print(x%%x)';print(x%x)
cpp #include <cstdio>
#define B(x) x; printf("{ B(" #x ") }\n");
int main()
{ B(printf("#include <cstdio>\n#define B(x) x; printf(\"{ B(\" #x \") }\\n\");\nint main()\n")) }
#include <cstdio>
#define B(x) x; printf("{ B(" #x ") }\n");
int main()
{ B(printf("#include <cstdio>\n#define B(x) x; printf(\"{ B(\" #x \") }\\n\");\nint main()\n")) }
Submit a new solution for
python,
csharp, or
cpp
There are 22 other solutions in
additional languages (
clojure,
fantom,
fsharp,
groovy ...)