Javascript Prime Number Program - How to Check if a Number is a Prime Number | JavaScript Program
ฝัง
- เผยแพร่เมื่อ 18 พ.ย. 2024
- In this video, learn Javascript Prime Number Program - How to Check if a Number is a Prime Number | JavaScript Program. Find all the videos of the JavaScript Programs - Basics to Advanced Course in this playlist: • JavaScript Programs Se...
💎 Get Access to Premium Videos and Live Streams: / @wscubetech
WsCube Tech is a leading Web, Mobile App & Digital Marketing company, and institute in India.
We help businesses of all sizes to build their online presence, grow their business, and reach new heights.
👉For Digital Marketing services (Brand Building, SEO, SMO, PPC, SEM, Content Writing), Web Development and App Development solutions, visit our website: www.wscubetech...
👉Want to learn new skills and improve existing ones with in-depth and practical sessions? Enroll in our advanced online courses now and make yourself job-ready: courses.wscube...
All the courses are job-oriented, up-to-date with the latest algorithms and modules, fully practical, and provide you hands-on projects.
👉 Want to learn and acquire skills in English? Visit WsCube Tech English channel: bit.ly/2M3oYOs
📞 For more info about the courses, call us: +91-9024244886, +91-9269698122
✅ CONNECT WITH THE FOUNDER (Mr. Kushagra Bhatia) -
👉 Instagram - / kushagrabhatiaofficial
👉 LinkedIn - / kushagra-bhatia
Connect with WsCube Tech on social media for the latest offers, promos, job vacancies, and much more:
► Subscribe: bit.ly/wscubech...
► Facebook: / wsubetech.india
► Twitter: / wscubetechindia
► Instagram: / wscubetechindia
► LinkedIn : / wscubetechindia
► TH-cam: / wscubetechjodhpur
► Website: wscubetech.com
-------------------------------------| Thanks |--------------------------
#JavascriptPrograms #JavascriptProjects #ProgramsinJavascript
Excellent logic!!! One thing I would add here is the missing of break function. Since it is not added, it shows non-prime number as prime number. For Example:4. Once I added, it worked properly.
is video me aapke itne km likes hain or ab to ab super se uppar hogye keep going and never give up!
If number
What about if we enter the number as 2?
Thank you your code is very fast
When we enter 2 then it's give undefined why
Thank you
Sir 2 number ko run karayiye nhi ho rha undefined output aa rha hai
if i enter 2 ?
number =2;
Let's assume, i = 2; i
I put one more else if condition for particular 2 number and it solved🥰
Bhai me bhi yahi bolne aaya tha ki 2 ka ky😅
Thanks alot sir❤️
11:11 5 prime number nahi hai aapne bola 😅
let num = 2;
if (num == 1) {
console.log(`${num} is neither prime nor composite`);
} else if (num < 1) {
console.log(`${num} is not a prime number`);
} else {
let isPrime = true;
for (let i = 2; i < num; i++) {
if (num % i === 0) {
isPrime = false;
break;
}
}
if (isPrime) {
console.log(`${num} is a prime number`);
} else {
console.log(`${num} is not a prime number`);
}
}
Updated version of code
2 kaise check hoga
Code is not working 😮😮
first!
❤
Sir 2 number ko run karayiye nhi ho rha undefined output aa rha hai