Omrita is all determined to learn programming. This semester she is taking “Introduction to C programming”. Being a bright student she quickly covered the basics and managed to finish all the assignments way before the dead line. Her Instructor is very impressed by her work and decided to give her some more assignment. A typical assignment on C programming is:
Write a C program that takes an positive integer as input and determines whether it is a prime or not. If it is a prime output “YES” else output “NO”.
Of-course this is very easy for Omrita. So her instructor modified the assignment. Now, if an composite number is encountered in the input, instead of printing “NO” the
program should behave like a quine i.e output itself.
Omrita have no clue about writing quine. Hence, she asked for your help.
A line contains an integer N.
The required string described above.
1 ≤ N ≤ 10000
case 1: 7 is a prime number, hence the output “YES” (quotes for clarity).
case 2: 64 is not a prime number, hence the output is the program (source) itself.
WHEN I TRIED TO SOLVE THIS I TRAPPED IN RECURSIVE PRINTING.
PLEASE HELP ME IN WRITING QUINE.