To find the area of a rhombus, we need to know the length of its diagonals. Here's a Rust function that takes in the lengths of the diagonals and returns the area of the rhombus:
main.rs93 chars4 lines
We can use this function as follows:
main.rs169 chars7 lines
This will output:
main.rs30 chars2 lines
Note that the length of the diagonals should be in the same units (e.g. both in centimeters) for this formula to work.
gistlibby LogSnag