Frequently Asked Java Program 11: Check Given Number is Prime Or Not

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ย. 2024
  • Frequently Asked Java Program
    Check Given Number is Prime Or NotPrime Number:
    ------------------------------
    Natural Number greater than 1
    Which has only 2 factors 1 and itself
    19 1 and 19 Prime Number
    28 1,2,4,7,14,28 Not a Prime Number
    Examples: 2, 3, 5, 7, 11, 13, 17..
    #########################
    Udemy Courses:
    #########################
    Manual Testing+Agile with Jira Tool
    ************************************
    ► shorturl.at/xNXZ4
    Selenium with Java+Cucumber
    ********************************
    ► shorturl.at/aIKMW
    Selenium with Python & PyTest
    ********************************
    ► shorturl.at/ELW09
    Selenium with python using Robot framework
    ****************************************
    ► shorturl.at/bcDPZ
    API Testing(Postman, RestAssured & SoapUI)
    *****************************************
    ► shorturl.at/uAWY7
    Web & API Automation using Cypress with Javascript
    ********************************************
    ► rb.gy/4uum2n
    Playwright with Javascript
    **************************
    ► shorturl.at/gALZ1
    Jmeter-Performance Testing
    ************************
    ► rb.gy/ocj7r2
    SDET Essencials(Full Stack QA)
    *************************
    ► rb.gy/hlnf2v
    Appium-Mobile Automation Testing
    ************************************
    ► rb.gy/wmzv64
    Java Collections
    *****************
    ► bit.ly/3S66ezE
    Python Programming
    *********************
    ► urlis.net/gdsf...
    Cucumber BDD Framework
    ***************************
    ► bit.ly/3F7d69r
    Protractor with Javascript
    ***************************
    ► urlis.net/4udd...
    ####################################
    TH-cam Playlists:
    ####################################
    Manual Testing & Agile
    ***********************
    ► bit.ly/3ujvaYa
    ► bit.ly/3OYzxQj
    SQL
    *************************
    ► bit.ly/3R6XjeG
    ► bit.ly/3nE0a1s
    ► bit.ly/3IeKuuJ
    linux & Shell Scripting
    **********************
    ► bit.ly/3up1Z6a
    ► bit.ly/3nzvGxx
    Java
    **********************
    ► bit.ly/3R9QfOs
    ► bit.ly/3AoRMKM
    ► bit.ly/3IbTTDn
    ► bit.ly/3ybXInv
    ► bit.ly/3yCoHdw
    Selenium With Java+Cucumber
    ********************************
    ► bit.ly/3P2FMm4
    ► bit.ly/3yhiIt4
    ► bit.ly/3uokzet
    ► bit.ly/3a7XIND
    ► bit.ly/3umN2S9
    ► bit.ly/3aar7GW
    ► bit.ly/3y9kD2S
    ► bit.ly/3uhLskn
    Python
    ********************************
    ► bit.ly/3agNgU0
    ► bit.ly/3NJNnoy
    ► bit.ly/2CTQ4mR
    ► bit.ly/3OIYWh1
    Selenium With Python,Pytest&Behave
    ***************************************
    ► bit.ly/3OHHoC9
    ► bit.ly/3IeNLdv
    ► bit.ly/2J4tPeT
    ► bit.ly/3ydSkAq
    Selenium With Python Using Robert Framework
    (Web&API Testing)
    *************************************************
    ► bit.ly/3nUvlpr
    ► bit.ly/3nUvE3z
    API Testing (Postman,SoapUi,&Rest Assured)
    **********************************************
    ► bit.ly/3OXacWY
    ► bit.ly/3yh0UhE
    ► bit.ly/3nC9DWQ
    ► bit.ly/3yGfhNS
    ► bit.ly/3OJa11H
    ► bit.ly/3P2slCC
    Mobile App Testing Appium
    ****************************
    ► bit.ly/3Al49HG
    Performance Testing Jmeter
    *******************************
    ► bit.ly/3nz4fE7
    Maven,Jenkins,Git,Github,CI/CD
    *******************************
    ► bit.ly/3P16HPj
    ► bit.ly/3yhlUVA
    ► bit.ly/3afYfwT
    ► bit.ly/3yGzweG
    ► bit.ly/3yF73Ws
    ► bit.ly/3NCOmH7
    SQL,DB Testing&ETL,Bigdata
    *******************************
    ► bit.ly/3NKOcNY
    ► bit.ly/3OVpDyI
    ► bit.ly/3NEvUy0
    ► bit.ly/3IryxlT
    ► bit.ly/3RkWBLh
    JavaScript Based Automation Tools
    ********************************
    ► bit.ly/3nUx51X
    ► bit.ly/3AqI6Q0
    ► bit.ly/3yeurbT
    ► bit.ly/3ujzpTK
    Selector Hub Tools
    ********************
    ►rb.gy/h3h424
    GraphQL
    ******************
    ► rb.gy/sj3gys
    Cypress API Testing
    ********************
    ► shorturl.at/fjKPX
    Cypress Web Testing
    **********************
    ► shorturl.at/agjlK
    Playwright with Javascipt
    **************************
    ► shorturl.at/adSTY
    #PrimeCheck
    #PrimeOrNot
    #PrimeTest
    #IsItPrime
    #PrimeNumber
    #NumberTheory
    #Mathematics
    #NumberProperties
    #Primality
    #NumberAnalysis
    #PrimeAlgorithm
    #NumberDivisibility
    #NumberTheory101
    #NumberPuzzles
    #MathPuzzles
    #PrimeChallenge
    #MathHelp
    #NumberCuriosity
    #MathEnthusiast
    #NumberQuiz
    #PrimeSieve
    #NumberPatterns
    #PrimeExploration
    #MathGeek
    #PrimeDiscovery
    #NumberInvestigation
    #PrimeInquiry
    #MathMagic
    #PrimeWisdom
    #NumberInsight
    #PrimeQuest
    #MathWhiz
    #PrimeInsights
    #NumberMagic
    #PrimeJourney
    #MathChallenge
    #NumberAdventures
    #PrimeJungle
    #MathWonders
    #PrimeInspection
    #NumberPioneers
    #MathExploration
    #PrimeHunters
    #NumberMysteries
    #PrimeOdyssey
    #MathPioneers
    #NumberGenius
    #PrimeVenture
    #MathAdventures
    #NumberGeniuses

ความคิดเห็น • 90

  • @iamms351
    @iamms351 3 ปีที่แล้ว +10

    Please add star pattern questions and metrics multiplication in this series

  • @EdClarkHYCT
    @EdClarkHYCT 4 ปีที่แล้ว +8

    Great video! Awesome solution! Keep up the great work!!👌👍👏

  • @arabindamohanty2190
    @arabindamohanty2190 4 ปีที่แล้ว +2

    Really the way u explain I understood all the program 🙏🙏🙏

  • @sirmonke8946
    @sirmonke8946 ปีที่แล้ว +5

    //This is an old video but I think this is a better solution
    class Main {
    public static void main(String[] args) {
    int num = 3;
    boolean isPrime = true; //default
    for (int i=2; i

  • @theoneinyou2233
    @theoneinyou2233 ปีที่แล้ว

    simply go like this
    public static String isPrime(int n)
    {
    for(int i=2;i

  • @sweetyraghav9637
    @sweetyraghav9637 ปีที่แล้ว +1

    Superb explanation sir , really loved ur videos and very useful keep going

  • @RajeshPasupuleti-xn5ti
    @RajeshPasupuleti-xn5ti ปีที่แล้ว

    In if condition use if(count>=2) This gives good results

  • @parshu3238
    @parshu3238 3 ปีที่แล้ว

    This is grate explation for understand but we are using lot of loop, we should consider big O notation as well

  • @mahalakshmi-or9iq
    @mahalakshmi-or9iq 2 ปีที่แล้ว +1

    Excellent Explanation

  • @maheshdeore7330
    @maheshdeore7330 ปีที่แล้ว +1

    Good Explanation

  • @gokulkrish8139
    @gokulkrish8139 3 ปีที่แล้ว +1

    Why this can't be put in Scanner Class??

  • @vikashkr14296
    @vikashkr14296 7 หลายเดือนก่อน

    Sorry to interrupt you but till 5:33 you are talking about palindrome number and your title is not matching with our voice.
    I can't imagine how did you uploaded this video.

  • @satishgollu9106
    @satishgollu9106 2 ปีที่แล้ว +5

    U r explaining prime number.... Not palindrome number🤷‍♂️

  • @amritsnehi5975
    @amritsnehi5975 2 ปีที่แล้ว

    PALINDROME NUMBER BOL RHE SIR I THINK BY MISTAKE , PRIME NO HOGA NA SIR?

    • @amritsnehi5975
      @amritsnehi5975 2 ปีที่แล้ว

      I WATCHED YOUR ALL VIDEOS OF THIS PLAYLIST, REALLY AMAZING CONTENT, I THINK THIS PLAYLIST WILL EXPERT TO ME IN JAVA, U ARE THE GOD OF MY LIFE DURING THIS PERIOD TEACHING JAVA,

  • @ghareluupaylearnings
    @ghareluupaylearnings 4 หลายเดือนก่อน

    Lol 😂😂 explaining prime number and showing palindrome number 😂

  • @kaneezfatma4935
    @kaneezfatma4935 4 ปีที่แล้ว +18

    Palindrome number 🤭🤭

    • @ashubtech9911
      @ashubtech9911 3 ปีที่แล้ว +28

      In this large world....no can appreciate one's success....but they will definitely identify one's mistake....use common sense and appreciate him....

    • @based1708
      @based1708 ปีที่แล้ว

      This comment is so funny kek.

    • @priyanshumodiani_007
      @priyanshumodiani_007 10 หลายเดือนก่อน

      😂

  • @hemmishra1102
    @hemmishra1102 ปีที่แล้ว

    import java.util.Scanner;
    public class PrimeNumber {
    public static void main(String[] args) {
    System.out.println("Enter a number:");
    Scanner sc=new Scanner(System.in);
    int num ;
    num =sc.nextInt();
    int i=1;
    int count=0;
    if (num!=1)
    {
    while (i

  • @neerajk_10
    @neerajk_10 3 ปีที่แล้ว +18

    Good explanation. But I think we should further optimize it by keeping the limit to i 2. If yes, immediately exit the loop. This will save a lot of time for big numbers.

    • @rishabhbillore7979
      @rishabhbillore7979 2 ปีที่แล้ว +1

      no bro what if i input 5 than it will only divide 5 with 1 and 2 so the count will be 1 only so it will give output that 5 is not prime number

    • @sirmonke8946
      @sirmonke8946 ปีที่แล้ว +1

      year old comment but it should be i

    • @akkiroy5871
      @akkiroy5871 ปีที่แล้ว

      @@rishabhbillore7979 we can change the condition as
      If(count==1)
      {
      System.out.println("prime no.");
      }

  • @samiullah2039
    @samiullah2039 4 ปีที่แล้ว +15

    not palindrome but prime, small fix needed, Rest great explaination

  • @SurajKumar-qm4gj
    @SurajKumar-qm4gj 12 วันที่ผ่านมา +1

    Thanks sir ❤..You are very great..explained in a very simple manner 🙏👌🤌

    • @sdetpavan
      @sdetpavan  11 วันที่ผ่านมา

      It's my pleasure

  • @Rhg2204
    @Rhg2204 2 ปีที่แล้ว +2

    can we just loop till num/2 and make if statement to count=1? it will also show if its prime or not

  • @johnnyjohn9134
    @johnnyjohn9134 5 ปีที่แล้ว +3

    You are a great teacher! Tell me please when do You LL make java and c++ pe phyton tutorials for begginers?!

  • @aisumolda6794
    @aisumolda6794 2 ปีที่แล้ว +1

    You said Prime number As a Polindrome Its not correct

  • @human_curiosity1
    @human_curiosity1 ปีที่แล้ว +2

    Nice explanation

  • @kvelez
    @kvelez ปีที่แล้ว

    package javaapplication23;
    import java.util.Scanner;
    public class JavaApplication23 {
    public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);

    System.out.println("Num: ");
    int n = scan.nextInt();

    String value = "";

    for (int i = 2; i

  • @SanjayVerma-qd3ur
    @SanjayVerma-qd3ur 3 ปีที่แล้ว +2

    Explain tracing also

  • @surya-ow4wr
    @surya-ow4wr 2 ปีที่แล้ว +1

    Not understood if(count ==2)

  • @prasana98
    @prasana98 2 ปีที่แล้ว

    excellent explanation sir but you've mentioned 2 is not a prime number. that's wrong. 2 is a Prime number.

  • @vineelavineelapilla4117
    @vineelavineelapilla4117 2 หลายเดือนก่อน +1

    Thank you so much Sir😊

    • @sdetpavan
      @sdetpavan  2 หลายเดือนก่อน +1

      Welcome

  • @pravinbalwante3959
    @pravinbalwante3959 ปีที่แล้ว

    first use "if". condition for number greater than 1 and then take inner if for scond condition that is (number divided by 2 it give remainder 1) and print statment for inner if is (it is prime number) otherwies take else (not prime)

  • @SUNNU-wg1sq
    @SUNNU-wg1sq 8 หลายเดือนก่อน +1

    Great explanation sir....Thank you

    • @sdetpavan
      @sdetpavan  7 หลายเดือนก่อน

      Welcome

  • @sangireddyeswarreddy1787
    @sangireddyeswarreddy1787 3 ปีที่แล้ว +1

    Iam very much loved your way of explanation ❤️❤️❤️❤️❤️❤️ .

  • @lakshmidevilakshmidevi3984
    @lakshmidevilakshmidevi3984 ปีที่แล้ว +1

    Thanks for the clear explanation Sir

  • @kaneezfatma4935
    @kaneezfatma4935 4 ปีที่แล้ว +2

    Thnxx alot sir for explaining and clearing our logic

  • @tejajami6729
    @tejajami6729 10 หลายเดือนก่อน

    sir, ones explain the print the 20th prime number program

  • @start1learn-n171
    @start1learn-n171 5 หลายเดือนก่อน +1

    TQ

    • @sdetpavan
      @sdetpavan  5 หลายเดือนก่อน

      Welcome

  • @UmmayamanAman
    @UmmayamanAman 3 หลายเดือนก่อน

    Prime number with in a range ?

  • @gauri992
    @gauri992 3 ปีที่แล้ว +1

    ur the best sir

  • @sanjayyadav-xe7mf
    @sanjayyadav-xe7mf 2 ปีที่แล้ว +1

    best solution thanks a lot

    • @sdetpavan
      @sdetpavan  2 ปีที่แล้ว

      Most welcome

  • @kmkbabu3
    @kmkbabu3 3 ปีที่แล้ว +1

    Excellent bro

  • @HarshTV97
    @HarshTV97 2 ปีที่แล้ว +6

    Lets simplify this program::-
    main()
    {
    int num=10;
    int count=0;
    for(int i=2;i

    • @NuanDaa
      @NuanDaa 2 ปีที่แล้ว +1

      this gives a result 9 is a prime number which in not

    • @duggirambabu7792
      @duggirambabu7792 2 ปีที่แล้ว

      if(num%i==0)
      {
      count=1;
      break;
      }

    • @jeevan554
      @jeevan554 วันที่ผ่านมา

      @@NuanDaa No it's correct

  • @vijayalakshmisuren3152
    @vijayalakshmisuren3152 2 ปีที่แล้ว +1

    Very Good explanation... Thank you...

    • @sdetpavan
      @sdetpavan  2 ปีที่แล้ว

      Most welcome

  • @gautampandey1685
    @gautampandey1685 11 หลายเดือนก่อน +1

    superbb

    • @sdetpavan
      @sdetpavan  11 หลายเดือนก่อน

      Thanks

  • @JanuJanu-iz7vw
    @JanuJanu-iz7vw 2 ปีที่แล้ว +1

    Super explanation sir

  • @yggamingtech6109
    @yggamingtech6109 ปีที่แล้ว

    How to print range of prime numbers

  • @lakshmidevilakshmidevi3984
    @lakshmidevilakshmidevi3984 ปีที่แล้ว +1

    Very nice explanation

  • @kassasuresh3909
    @kassasuresh3909 ปีที่แล้ว

    Ur way of teaching is verygood.

  • @aloksinghkushwaha4615
    @aloksinghkushwaha4615 3 ปีที่แล้ว

    how to find total prime number in range

  • @aries2aqua
    @aries2aqua 2 ปีที่แล้ว +1

    Thank you

  • @shashankdwivedi4354
    @shashankdwivedi4354 3 ปีที่แล้ว

    Please explain

  • @prasadbuddhala758
    @prasadbuddhala758 4 ปีที่แล้ว +1

    Good

  • @lakshmidevilakshmidevi3984
    @lakshmidevilakshmidevi3984 ปีที่แล้ว +1

    Best playlist .Thank you Sir

  • @preetiparnasahoo5084
    @preetiparnasahoo5084 2 ปีที่แล้ว

    Efficient code:
    public class PrimeNumber {
    public static void main(String[] args) {
    int n = 27;
    if (n < 2) {
    System.out.println("Not prime");
    return;
    }
    for (int i = 2; i * i