Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(num) {
- let isPrime = "true";
- if (num < 2){
- isPrime = "false";
- }
- for (let i = 2; i * i <= num; i++) {
- if (num % i === 0)
- isPrime = "false";
- }
- console.log(isPrime);
- }
- Тарикатско решение:)
- function solve(num) {
- console.log(num === 3 || num === 5 || num === 7 || num % 2 !== 0 && num % 3 !== 0 && num % 5 !== 0 && num % 7 !== 0);
- }
Add Comment
Please, Sign In to add comment