Exercise · Loops · lesson 8 of 8
Exercise: prime number
Write a function func isPrime(n int) bool that returns true if n is a prime number and false otherwise. A prime number is greater than 1 and is divisible only by 1 and itself.
isPrime(97)→trueisPrime(91)→falseisPrime(2)→true
Constraints: n is from 0 to 10000; 0 and 1 are not prime.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.