Java Program to find Prime Numbers Between 1 to 100

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 มิ.ย. 2019
  • In this video we will learn how to write a java program to find prime numbers between 1 to 100.
    Prime Number:
    It is a number that is divided by itself or 1. That means we can not divide other number than 1 or itself.
    Example:
    2,3,5,7,11,13,17.....
    Please correct the above program with open and close brackets:
    1. add open bracket in 12th line
    2. close bracket after 15th line
    3. add open bracket in 16th line
    4. finally add close bracket in the last line in the program...
    Sorry for the inconvenience ....in the coming session will not happen like this.
    Thank you for your cooperation ....
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @nasreennasu1999
    @nasreennasu1999 3 ปีที่แล้ว +19

    It is displaying odd numbers not prime numbers

    • @varadharajulu.g312
      @varadharajulu.g312 3 ปีที่แล้ว

      Absolutely

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

      Yes.
      Now change the code like this way
      if(i%j==0)
      {
      s=1;
      break;
      }
      Now it prints prime numbers.

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

      yaaaa it is not correct .the code is wrong that is not prime numbers plzzz check it sir

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

    Thank you for Video. It Helped me alot @lucky techzone

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

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

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

    Great explaination🙏

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

    what is the purpose of j++ it also gets incremented in the 2nd iteration right ?

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

    Extraordinary explanation. Thanks a lot sir

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

      Thankyou very much 👍👍 keep watching 👍👍

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

      @@byluckysir
      Sir, in this what is purpose of j++
      J++ not update..

  • @kalidassneelamegam5756
    @kalidassneelamegam5756 4 ปีที่แล้ว

    Explain how to get the given number(using scanner class) is prime or not.... Please

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

    Awesome coding

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

    Thanks for the explanation!

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

      Glad it was helpful!

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

      Happy to help

  • @prasanthkumar8265
    @prasanthkumar8265 4 ปีที่แล้ว

    explanation ok but i have small dought why did you take scanner method

    • @byluckysir
      @byluckysir  4 ปีที่แล้ว

      Scanner can use tokenize using custom delimiter and parse the stream into primitive types of data

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

    The break statement should be inside the if condition

  • @kamisettymounya8325
    @kamisettymounya8325 4 ปีที่แล้ว

    Nice explaination sirr

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

    In this code what purpose of j++

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

    Thank u bro

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

      Most welcome 👍👍

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

    Really super explanation

    • @Tarra_Rajeswari
      @Tarra_Rajeswari 5 ปีที่แล้ว

      I like the explanation

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

      class primeNumber
      {
      public static void main(String args[]){
      int i,s,j;
      for(i=2;i

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

      @@byluckysir The logic you used doesn't work for prime number please verify your logic again. Your logic is able to print other than prime numbers also. For eg: 9,15,21,27 and so on

    • @byluckysir
      @byluckysir  4 ปีที่แล้ว

      @@varakits1062 Thank you for your comment, In this program logic works perfectly but open and close bracket issue crates wrong output, I suggest you check video description where i explained in detail..Thank you for your cooperation.

    • @minajshaikh6988
      @minajshaikh6988 4 ปีที่แล้ว

      Software programming development for the further interview

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

    How the hell is 9 a prime number? 9 can be divided by 3 as well sir...then I saw description..Thank you

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

      So do you got desired output???

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

      If so, kindly share the correct program

  • @minajshaikh6988
    @minajshaikh6988 4 ปีที่แล้ว

    If condition.
    Switch case..
    If else system
    Public static void main

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

    Multiples of 3 are coming in output bro is it wrong r what... ¿

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

      Please check the description, logic is right, open and close brace wrong, i have instructed in the description please check 👍👍👍

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

      No it is not correct in explaination also

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

      Printing the same output as earlier

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

      Either create new program with new link

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

    Sir , prime numbers are like 2,3,5,7,11,13,17,23......97. In your output display only odd numbers did not get prime numbers please check once again in output.

    • @aptptl
      @aptptl 4 ปีที่แล้ว

      i agree with you

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

      Hi Ajay here is the correct code
      int num = 100;
      for(int i = 2;i

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

      @@simhachalambure2230 second for loop lo j

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

    J++ means what

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

      ++ is increment operator in java

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

    J++ why not update ..

  • @RavindraKumar-eb3db
    @RavindraKumar-eb3db 2 ปีที่แล้ว

    LOGIC IS WRONG DEAR FRIENDS

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

      please check video description

  • @b.rajeshkumar3227
    @b.rajeshkumar3227 2 ปีที่แล้ว

    How 9 is a prime number ?

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

      Please check video description , little code correction required 👍👍