Write the code where you get a number and print out the sum of every even element from zero to the given number using the goto statement (without using loops).
Goto and labels
Goto loop
Report a typo
Sample Input 1:
1Sample Output 1:
0Write a program in Go
package main
import "fmt"
func main() {
var i, num, sum int
fmt.Scan(&num)
?:
if i%2 == 0 {
sum += ?
}
i++
if i <= num {
goto ?
}
fmt.Println(?)
}
___
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.