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")
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')
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")
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")
#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 ??
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")
🤝
What if I check 15
crystal clear explanation!!
Iam regularly following your lectures.. very clear
thank you :)
Bro do you get the job ? Pls reply
Awesome 🛕🛕🕉️🕉️🌹🌹🚩🚩🙏🙏🛕🛕🌞🌞🌸🌸🌞🌞⛳⛳Sir
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')
Sudeep sir, pls explain on number 2 which is as prime...as i tried the code you shared.
Hello
Would you be interested in doing the world's first implementation of the MMSieve prime generation method in Python?
What about number 2 , it is also prime numbr
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.
By this logic u r getting 2 as prime number only....
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
2 is a prime
what about 9 and 15 ?????
hello sir. in this program the output for 1 is shows prime number. But 1 is not a prime.can you please clarify.
Prime no. Have 2 factor but 1 has only one factor .that's why 1 is not prime
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")
Sir upload django lectures please
if i enter 1 ,then i am getting 1 is a prime number.but 1 is not a prime number
I am understand
sir sochte kaise hai ki python code likha kaise jaiga????? please ispe video banaye...
how to check nearest prime number of given number
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")
and 3 also\
incomlete code: try to enter any prime number in this code and it willl run until n-1
How to print first 100 prime numbers sir
Our next video is on prime series
Keep following our channel
@@sundeepsaradhi ok sir. Thank you 😊
What about 2
take 2 and explain
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
Anna Nuvvu ....?
#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 ??
else condition is outside if statement
Hi
Replace n with num in n%i