Posted: Tue Sep 25, 2007 4:40 pm Post subject: prime number detector
I was bored so i made this
Turing:
var num :int var sent :int:=0
proc prime (value :int) for i :2.. value
for ii :2.. value
if i * ii = value then put i, '*', ii
sent +=1 endif endfor endfor if sent =0then put"Prime number" endif
sent:=0 end prime
loop put"enter a number: "..
get num
prime (num) locate(1, 1) Input.Pause cls endloop
it tells you if the inputted number is a prime number and if not then it outputs all the possiblities to get the number via multiplacation
Sponsor Sponsor
Tony
Posted: Tue Sep 25, 2007 6:48 pm Post subject: Re: prime number detector
momop @ Tue Sep 25, 2007 4:40 pm wrote:
all the possiblities to get the number via multiplacation
Posted: Tue Sep 25, 2007 6:50 pm Post subject: Re: prime number detector
lmao whatever it works and i forgot the name anyways thanks for the reminder
pps i made this program in like 5 mins tops so if theres any errors... well it was bound to happen
Cervantes
Posted: Tue Sep 25, 2007 7:17 pm Post subject: RE:prime number detector
That's called self-handicapping, and that's a bad thing.
HeavenAgain
Posted: Tue Sep 25, 2007 7:18 pm Post subject: RE:prime number detector
theres no need to rush
how about try making this code more efficient?
whats the difference between 1x10 and 10x1?
so why bother making your 2nd loop run from the beginning again?
and another small thing, 1 or anything lower are not prime numbers
Nick
Posted: Tue Sep 25, 2007 7:21 pm Post subject: RE:prime number detector
oh yea... i forgot to run the loop from 2... whoops
anyways Cervantes i usually don't make mistakes and when i do i can usually spot them and fix em easily i was just making a joke