tags:

views:

55

answers:

4

Is that possible to write a program that reads in a integer n and outputs the program itself n times?

A: 
#define YOUR_PROGRAM_LANGUAGE

:p

ps: haven't heard of something like that so far. Sounds like you need to instruct your compiler in a special way

SirLenz0rlot
The problem is well known, it's called a quine.
Andreas Brinck
+2  A: 

Yes it is possible.

Dominic Rodger
A: 

A program that prints itself as output is known as a Quine. So yes, this is possible.

Oded
A: 

Yes, it's possible. A program that prints out its own source code is known as a Quine; it's easy to find examples for all kinds of programming languages.

Modifying those to repeat the output n times should not be too difficult.

Michael Borgwardt