find the area of a parallelogram in swift

Here is the code to find the area of a parallelogram in Swift:

main.swift
let base = 10.0
let height = 5.0
let area = base * height
58 chars
4 lines

In the code above, we declared two constants base and height to represent the base and height of the parallelogram, respectively. We then calculated the area of the parallelogram by multiplying the base and height values together and storing the result in the constant area.

Note that this assumes the parallelogram is a simple parallelogram, where the two opposite sides are equal in length and parallel to each other. If the parallelogram is more complex, with different side lengths or angles, the formula for calculating the area will be different.

gistlibby LogSnag