Area of a Rectangular Room

Read the length and width in feet of a rectangle room. Print the area of the room in both square feet and square meters.

This is a simple exercise to practice calculation.

The area in square feet is simply the product of the sizes in feet length_ft, width_ft. To calculate the area in square meters, we can first convert the width and length to meter then multiply them.

    let area_ft2 = length_ft * width_ft;

    let length_m = length_ft * FT_TO_M;
    let width_m = width_ft * FT_TO_M;
    let area_m2 = length_m * width_m;

where FT_TO_M is a constant conversion factor:

const FT_TO_M: f64 = 0.3048;