Advertisement
BobMe

Chemistry Cheats

Nov 26th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. -- AAAAAAAAAAAAAAA
  2. --[[function afterdeci(x)
  3. local k = tostring(x)
  4. for i=1,#k do
  5. if string.sub(k,i,i) == "." then
  6. return string.sub(k,i+1,i+)
  7. end
  8. end
  9. end]]
  10.  
  11. function round(x,roundto)
  12. local k = tostring(x)
  13. local num
  14. local dot = 0
  15. for i=1,#k do
  16. if string.sub(k,i,i) == "." and dot == 0 then
  17. dot = i
  18. elseif dot ~= 0 then
  19. num = string.sub(k,1,dot+roundto)
  20. break
  21. end
  22. end
  23. return tonumber(num)
  24. end
  25.  
  26. local molar_mass = 58.442407
  27. local value = 26.32
  28. local atoms = 2
  29.  
  30. local moleingram = value*(1/molar_mass)
  31. print("Moles in gram: "..round(moleingram,2))
  32. local molestoliter = moleingram*22.4
  33. print("Gram moles to liter: "..round(molestoliter,2))
  34. local molecules = moleingram * (6.02*10^23)
  35. print("Gram moles to "..round(molecules,2))
  36. local molecules2 = molecules * atoms
  37. print(molecules2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement