Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Primanac v1.0 ALPHA")
- print("Enter an integer. Any number that has decimals will be floored.")
- local notregistered = true
- while notregistered do
- write("Number: ")
- local num = io.read()
- num = math.floor(num)
- print("The number registered is "..num..". Continue?")
- local notdone = true
- while notdone do
- local continue = read()
- if continue == "Yes" then
- notdone = false
- notregistered = false
- elseif continue == "No" then
- notdone = false
- else
- print("Invalid answer.")
- end
- end
- end
- for numtodivide = 1,Num do
- if numtodivide == 1 then
- numtodivide = 2
- end
- local result1 = num / numtodivide
- if numtodivide == num then
- print(num.." is prime!")
- elseif not result1 == math.floor(result1) then
- print(num.." is not divisible by "..numtodivide.."...")
- elseif result1 == math.floor(result1) then
- print(num.." is not prime, it is divisble by "..numtodivide.."!")
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement