Created
June 25, 2018 12:01
-
-
Save Deleplace/7fd65fc65a678fb94e752001a1042c9e to your computer and use it in GitHub Desktop.
Reads integers from stdin. How many of them verify (x % 8) == 5 ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io" | |
) | |
func main() { | |
var x, hits int | |
for { | |
_, err := fmt.Scan(&x) | |
if err == io.EOF { | |
break | |
} | |
if err != nil { | |
panic(err) | |
} | |
if x%8 == 5 { | |
hits++ | |
} | |
} | |
fmt.Println(hits) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment