The simplest question in Codechef is reading from input and writing to output as long as the number isn't 42. I wrote the following code:
package main
import "fmt"
func main() {
var num int8
fmt.Scanln(&num)
for ; num != 42; fmt.Scanln(&num) {
fmt.Println(num)
}
}
It is accepted, though uses 124.6M memory according to the site. I wrote basically the same thing in C and it took 1.6M, I'm confused. Do you know what may have caused this?
I'm new to Go. It may be a bold mistake.