Your friend Paul wrote a program that checks whether the number is even or odd. However, when he went to drink tea, his cat ran over the keyboard, and part of the code was changed. Help Paul recover the code.
Debugging Go code
Debug program
Report a typo
Sample Input 1:
Sample Output 1:
Number 11 is odd
Number 22 is even
Number 33 is oddWrite a program in Go
package main
import "fmt"
func main() {
var array = []int{11, 22, 33}
for i := range array {
fmt.Print("Number %d is %s", array[i], isEven(i))
}
}
func isEven(num int) string {
if num % 2 == 1 {
return "even"
}
return "odd"
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.