Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Determine If a pythag is actually a pythag. I know, this is simple and easy... TO JUSTIFY THAT, I had a very long math assignment assigned by my math teacher about determining if something is a pythag or not. Making a script would be quicker so uh, here you go have a blast to whoever is reading this.
- function is_pythag(a,b,c)
- local aa = a*a
- local bb = b*b
- local cc = c*c
- if aa + bb == cc then
- return {true,aa+bb,cc}
- else
- return {false,aa+bb,cc}
- end
- end
- g = is_pythag(3,4,5)
- if g[1] == true then
- bol = true
- else
- bol = false
- end
- print("Is pythag : "..tostring(bol).."\n"..g[2].." = "..g[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement