The volume V of a regular tetrahedron is given by V 112 Squ

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.

Solution

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);

 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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site