First commit

This commit is contained in:
2026-02-19 18:51:17 +02:00
commit 2d9b2318a9
16 changed files with 358 additions and 0 deletions

25
exercises/ch03/ex3_6.lua Normal file
View File

@@ -0,0 +1,25 @@
function Calculate_volume(height, angle)
local r = math.tan(angle) * height
return 1/3 * math.pi * r^2 * height
end
function Tests()
-- height, angle
local cases = {
{ 4.03, 3.55 },
{ 308, 380 },
{ 0.394, 0.826 }
}
for i = 1, #cases do
local case = cases[i]
local height = case[1]
local angle = case[2]
local volume = Calculate_volume(height, angle)
print(string.format("height: %f, angle: %f, volume: %f", height, angle, volume))
end
end
Tests()