0
Wap to input a number and check whether it is twin prime or not
7 Respostas
+ 2
def prime(n) :
c=0
for i in range (2,n):
if (n%i==0):
c+=1
break
return (c)
n1=int(input ("Enter a number"))
n2=int(input ("Enter a number"))
X=prime(n1)
Y=prime (n2)
if (x==0) and (y==0) and (n1-n2 ==2) and (n2-n1 ==2) :
print ("Twin prime number")
else :
print ("Not a twin prime")
+ 2
We should not present codes here, if someone is asking for it. We should request for a code or attempt that the akser has done (posted and linked in sololearn). On a short term it may be helpful for the asker to get something ready to use, but on a long term this is not the case. Lets give people hints or a sequence of pseudo code, or some other helpful things. Thanks!
+ 1
Thnxx Kiibo for the correction 😄
0
Plzzz check if the program is correct