Help with "Type Conversion" in Golang
Hi everyone, hope you are all well...
I am struggling with this problem in Golang "Type Conversion".
Here is my code:*
package main
import "fmt"
func main() {
var length float64 = 3.0
var width int = 4
var area int
area = int(length * float64(width) + 0.5) // Type conversion from float64 to int with rounding
fmt.Println("Area is:", area)
}
*the output is 12 nut the code says: Please check if the code for finding area is correct. *
*is there anything wrong with my code or this is a bug??