My issue
hello
please help me debug my code
My code
const n = parseInt(input);
// Function to check if a number is prime
function isPrime(x) {
// Implement your code here
var flag=0;
for(let j=2;j<x;j++){
if((x%j)==0){
var flag=1;
break;
}
}if(flag==0){
return x;
}
}
// Function to print prime numbers between l and r (inclusive)
function printPrimes(l, r) {
// Implement your code here
var result="";
for(let i=l;i<=r;i++){
var result=result+" "+isPrime(i)+" ";
}console.log(result);
}
printPrimes(n, 5 * n);
Problem Link: All Primes in Range Practice Problem in JavaScript