-
Notifications
You must be signed in to change notification settings - Fork 0
/
function.go
44 lines (31 loc) · 871 Bytes
/
function.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
)
func calculateBill(price, no int) int {
return price * no
}
func calculatePropertiesOfRectangle(length, width float64) (float64, float64) {
perimeter := 2 * (length + width)
area := length * width
return perimeter, area
}
func calculatePropertiesOfCircle(radius, pi float64) (area, perimeter float64) {
perimeter = 2 * pi * radius
area = pi * radius * radius
return
}
func main() {
price, no := 9000, 5
result := calculateBill(price, no)
fmt.Println(result)
fmt.Println(calculateBill(7900, 6))
perimeter, area := calculatePropertiesOfRectangle(6, 4)
fmt.Println(perimeter, area)
/** Name Return Value
**/
areaOfCircle, perimeterOfCircle := calculatePropertiesOfCircle(5, 3.143)
fmt.Println(areaOfCircle, perimeterOfCircle)
_, perimeterofCir := calculatePropertiesOfCircle(7, 9)
fmt.Println(perimeterofCir)
}