Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The volume V of a regular tetrahedron is given by V = 1/12 Squareroot 2 s^3 wher

ID: 3922660 • Letter: T

Question

The volume V of a regular tetrahedron is given by V = 1/12 Squareroot 2 s^3 where s is the length of the sides of the equilateral triangles that form the faces the tetrahedron. Write a program to calculate such a volume. The program consist of one script and one function. The function will receive one input argument, which is the length of the sides, and will return the volume of the tetrahedron. The script will prompt the user for the length of the sides, call the function to calculate the volume, and print the result in a nice sentence format. For simplicity we will ignore units.

Explanation / Answer

function v=volTetra(s)
v=(1/12)*sqrt(2)*(s^3)

script1.m

side=input('enter side of equilateral triangle :')
vol=volTetra(side)
fprintf(' volume of tetrahedron : %d',vol);