How to print program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to print program

how to print the source code of a program when it is executed . . in different languages. . (my requirement is, when the code get executed or interpreted the source code it self is printed along the desired result. . )

13th Nov 2017, 11:44 AM
kirAn sAi
kirAn sAi - avatar
6 Answers
+ 8
What do you want the program to do?
13th Nov 2017, 12:11 PM
qwerty
qwerty - avatar
+ 6
@kirAn You can't because it contains an input.
13th Nov 2017, 12:31 PM
qwerty
qwerty - avatar
+ 1
It's called a quine https://stackoverflow.com/questions/1479489/can-a-program-output-a-copy-of-itself. . I found many answers here, but not working as I want. .
13th Nov 2017, 12:08 PM
kirAn sAi
kirAn sAi - avatar
+ 1
consider the below code when I run it, it accepts input form user and displays lucky number. besides this I want to print the entire source code of the program at the output console when the code runs. https://code.sololearn.com/c83rw5ug4n72/?ref=app
13th Nov 2017, 12:18 PM
kirAn sAi
kirAn sAi - avatar
0
is it possible if it doesn't have any inputs
13th Nov 2017, 3:52 PM
kirAn sAi
kirAn sAi - avatar