
-----------------------------------
-JP-
Wed Apr 13, 2005 6:06 pm

Playing with Prime Numbers [Help!]
-----------------------------------
Well, it's been a while I came here due to some packed up projects/assignments, but yea, I need help on this...T_T


Write a program to display all the prime numbers from 1 to 50.


Now, of course using the put function and just putting all the prime numbers by yourself isn't fun in Turing, right? This program exercise was one in my textbook in the If Statements and Case Structure chapters, so it maybe need if statements.

Of course, we know that prime numbers have only 2 factors or less. I have understand to the part where it goes like this:


var num: int:= 2 % Any value is fine
var count: int:= 0
for counter: 1..num
if num mod counter = 0 then
count:= count+1
end if
end for
if count 