Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Find the area and perimeter in Go

This program is to find the area and perimeter using the simple function. Which will take the length and width has a parameter and return the area and perimeter.

package main

import (  
    "fmt"
)

func rectProps(length, width float64)(float64, float64) {  
    var area = length * width
    var perimeter = (length + width) * 2
    return area, perimeter
}

func main() {  
     area, perimeter := rectProps(10.8, 5.6)
    fmt.Printf("Area %f Perimeter %f", area, perimeter) 
}



output: Area 60.480000 Perimeter 32.800000