This commit is contained in:
Torma Kristóf 2019-10-07 00:07:26 +02:00
parent cd3249c51f
commit 19026753e6
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -17,14 +17,14 @@ func handler(w http.ResponseWriter, r *http.Request) {
}
log.Print("Checking if %s is prime", target)
if num <= 1 {
fmt.Sprintf("%d is not prime", num), nil
fmt.Sprintf("%d is not prime", num)
}
for i := 2; i <= int(math.Floor(float64(num)/2)); i++ {
if num%i == 0 {
fmt.Sprintf("%d is not prime", num), nil
fmt.Sprintf("%d is not prime", num)
}
}
fmt.Sprintf("%d is prime", num), nil
fmt.Sprintf("%d is prime", num)
}
func main() {