Section9-complete

This commit is contained in:
2023-11-08 13:42:52 +01:00
parent e98d21c4e1
commit 59ffa2443a
2 changed files with 67 additions and 4 deletions

42
Section9/76-3.go Normal file
View File

@@ -0,0 +1,42 @@
/*
Coding Exercise #3
There are some errors in the following Go program. Try to identify the errors,
change the code, and run the program without errors.
package main
import "fmt"
func main() {
myArray := [3]float64{1.2, 5.6}
myArray[2] = 6
a := 10
myArray[0] = a
myArray[3] = 10.10
fmt.Println(myArray)
}
*/
package main
import "fmt"
func main() {
myArray := [3]float64{1.2, 5.6}
myArray[2] = 6
a := 10
myArray[0] = float64(a)
myArray[2] = 10.10
fmt.Println(myArray)
}