Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
num = gets.to_i

last = gets.to_i

while (num <= last)
prime_flag = true

x = 2
while (x <= num/ 2)
if (num % x == 0)
    prime_flag = false
    break
end
x += 1
end
if prime_flag
    puts num
end

 num += 1
 end
Posted

1 solution

No.
Line by line explanations take far, far too long - typically a paragraph per line of code!
Would you want to sit down and write out that much for no good reason? Because I wouldn't! It's not even our code - you could ask the person who wrote it, but I suspect they won't want to either.

Instead, use the debugger to follow the code through and see if you can work it out yourself. You will learn a lot more that way than just getting an explanation of code you have copied from someone else...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900