Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def numeroPrimo(n1):
- i=1
- div=0
- while(i<=n1):
- if(n1%i==0):
- div=div+1
- i=i+1
- if(div==2):
- return(True)
- else:
- return(False)
- def primoCercano(n1):
- i=1
- signo=-1
- while(numeroPrimo(n1)==False):
- n1=n1+i
- i=(i+1)*signo
- if(numeroPrimo(n1)):
- return(n1)
- a=int(input("Ingrese entero"))
- print(primoCercano(a))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement