Definition of Quine

A quine program, or quine, is a program that outputs its own source code when runs without taking any input. It is called self-replicating program. Quines are possible in any Turing-complete programming language, as direct consequence of Kleene’s rescursion theorem.

Detour

Quine’s paradox on self-reference.

"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.

Another paradox:

If the human brain were so simple that we could understand it, we would be so si
mple that we couldn't. - Emerson M. Pugh

Another amusing quote:

Life must be lived forwards but can only be understood backwards.
- Kierkegaard

A quine in Python

_='_=%r;print _%%_';print _%_

A quine in Ruby

s="s=%p;printf s,s";printf s,s

A quine in C99

#include <stdio.h>
int main(){
char*s="#include <stdio.h>%cint main(){%cchar*s=%c%s%c;%cprintf(s,10,10,34,s,34,10);return 0;}";
printf(s,10,10,34,s,34,10);return 0;}

A quine in Rust

fn main(){print!("fn main(){{print!({0:?},{0:?})}}","fn main(){{print!({0:?},{0:?})}}")}

Reference