PRIME NUMBER PROGRAM IN PYTHON PROGRAMMING || PYTHON PROGRAMMING

Поділитися
Вставка
  • Опубліковано 4 гру 2024

КОМЕНТАРІ • 37

  • @tcimert
    @tcimert Рік тому +10

    num = int(input("Enter a number
    "))
    if num < 2:
    print("Enter a number greater than 1")
    elif num == 2:
    print(" 2 is a prime number")
    else:
    for i in range(2,num):
    if num%i ==0:
    print(num,"is not a prime number")
    break
    else:
    print(num,"is a prime number")

  • @gokulkrishnayt
    @gokulkrishnayt 2 роки тому +5

    crystal clear explanation!!

  • @nareddyaravindreddy
    @nareddyaravindreddy 2 роки тому +6

    Iam regularly following your lectures.. very clear
    thank you :)

  • @amitkumarchoubey2003
    @amitkumarchoubey2003 Рік тому +2

    Awesome 🛕🛕🕉️🕉️🌹🌹🚩🚩🙏🙏🛕🛕🌞🌞🌸🌸🌞🌞⛳⛳Sir

  • @seasonz75
    @seasonz75 Рік тому +1

    var=0
    for var in range (1,26): # input 25 times - regress testing
    n=int(input('Enter an Integer: '))
    flag=True
    if (n==2):
    print('Prime number')
    elif n!=2:
    for i in range (2,n):
    if(n%i==0):
    flag = False
    print('Not prime number')
    break
    else:
    print ('Prime number')

  • @seasonz75
    @seasonz75 Рік тому +1

    Sudeep sir, pls explain on number 2 which is as prime...as i tried the code you shared.

  • @marekmatusiak8397
    @marekmatusiak8397 2 роки тому +2

    Hello
    Would you be interested in doing the world's first implementation of the MMSieve prime generation method in Python?

  • @mandar2681
    @mandar2681 2 роки тому +9

    What about number 2 , it is also prime numbr

    • @murgan4307
      @murgan4307 2 роки тому +2

      Yaa that's the same quation but I think we need to follow the like m=n/2,insted of using n we can use m.

    • @NivasBhogapurapu
      @NivasBhogapurapu 9 місяців тому

      By this logic u r getting 2 as prime number only....

  • @sureshm8687
    @sureshm8687 2 роки тому +1

    Hi sir Iam good in python code but some difficult programs I can't understand, where can i get solutions for easy understanding please reply

  • @bhagyamahalakshmi349
    @bhagyamahalakshmi349 2 роки тому +2

    2 is a prime

  • @stech5596
    @stech5596 Рік тому +1

    what about 9 and 15 ?????

  • @ajaykumar-uz7qh
    @ajaykumar-uz7qh 2 роки тому +2

    hello sir. in this program the output for 1 is shows prime number. But 1 is not a prime.can you please clarify.

    • @puneet8669
      @puneet8669 2 роки тому

      Prime no. Have 2 factor but 1 has only one factor .that's why 1 is not prime

    • @shubhamneelgar196
      @shubhamneelgar196 Рік тому

      n=int(input("enter the number : "))
      if n>1:
      for i in range(2,n):
      if(n%i)==0:
      print(n,"is not a prime")
      break
      else:
      print(n,"is a prime")
      break
      else:
      print(n,"is not a prime")

  • @chiragkumar4196
    @chiragkumar4196 2 роки тому

    Sir upload django lectures please

  • @konahari3501
    @konahari3501 Рік тому +1

    if i enter 1 ,then i am getting 1 is a prime number.but 1 is not a prime number

  • @JosephL-g3m
    @JosephL-g3m 2 роки тому

    I am understand

  • @akshaypatil8155
    @akshaypatil8155 Рік тому

    sir sochte kaise hai ki python code likha kaise jaiga????? please ispe video banaye...

  • @JaswanthKumar-lx6hf
    @JaswanthKumar-lx6hf 10 місяців тому

    how to check nearest prime number of given number

  • @deepakSharma-cf5qo
    @deepakSharma-cf5qo 2 місяці тому

    Below code is giving error in pycharm and online compiler also. Can anyone help what is the issue.
    num = int(input("enter the number"))
    count = 0
    if num>1:
    for i in range(1,num+1):
    if num % i == 0:
    count = count+1
    if count == 2:
    print("prime")
    else:
    print("not prime")

  • @riyazbagban9190
    @riyazbagban9190 Рік тому

    and 3 also\

  • @pankajsahu9058
    @pankajsahu9058 Рік тому

    incomlete code: try to enter any prime number in this code and it willl run until n-1

  • @kopparthiharika1693
    @kopparthiharika1693 2 роки тому

    How to print first 100 prime numbers sir

    • @sundeepsaradhi
      @sundeepsaradhi  2 роки тому +1

      Our next video is on prime series
      Keep following our channel

    • @kopparthiharika1693
      @kopparthiharika1693 2 роки тому

      @@sundeepsaradhi ok sir. Thank you 😊

  • @ravitejagunisetti9973
    @ravitejagunisetti9973 Рік тому

    What about 2

  • @riyazbagban9190
    @riyazbagban9190 Рік тому

    take 2 and explain

    • @techtalksnow01
      @techtalksnow01 8 місяців тому

      as if loop check for num..It is equal to 2.In this case if loop doesnt get executed.So flag remains false hence it returns as prime

  • @Stream_Wars
    @Stream_Wars 2 роки тому

    Anna Nuvvu ....?

  • @shinysrivastava9208
    @shinysrivastava9208 9 місяців тому

    #wap to check if the number is prime or not
    num=int(input("Enter a number to check if it is prime : "))
    for i in range (2,num):
    if n%i==0:
    print (num, "is not prime")
    break
    else:
    print ("It is prime")
    this is still giving 11 as "not prime" why ??