Specify, by equation, a function which gives the area of a triangle given the lengths of the sides as arguments. (Use Heron's formula, which may be found in various mathematics references).
The area of a traingle is equal to the square root of the formula S(S-A)(S-B)(S-C) where S = (A+B+C)/2. Using this we can construct the 'TriArea' formula in rex:
rex> TriArea(a,b,c)=sqrt(((a+b+c)/2)*(((a+b+c)/2)-a)*
Note: a, b, and c need to be of type float to get an accurate result.
Specify, by enumeration, a function which gives the number of days in each month in the year (assume 28 for February).
rex> Months2Days=[0,31,28,31,30,31,30,31,31,30,31,30,31];
1
rex> Months2Days(2);
28
rex> Months2Days(12);
31
Return |