Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Some math solver thing
- -- Not sure what kind of math it is but it solves it
- function removedec(number)
- kek = number
- local strnum = tostring(number)
- for i=1,#strnum do
- if string.sub(strnum,i,i) == "." and string.sub(strnum,i+1,i+1) == "0" and string.sub(strnum,i+2,i+2) == "" then
- kek = tonumber(string.sub(strnum,1,i-1))
- end
- end
- return kek
- end
- function solve(tab)
- local bab = {}
- for i=1,#tab do
- local num = tab[i]
- local neg = false
- num = num/2
- if num < 0 then
- neg = true
- num = num * -1
- end
- if neg == true then
- sum = i.." | ".."(x-"..removedec(num)..")² | C : "..removedec(num*num)
- else
- sum = i.." | ".."(x+"..removedec(num)..")² | C : "..removedec(num*num)
- end
- table.insert(bab,#bab+1,sum)
- end
- for i=1,#bab do
- print(bab[i])
- end
- end
- solve({15})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement