Python program to return next prime number

A number that is divisible only by itself and 1 is called prime number. In this program we will print next prime number and input will be taken from user. def nextprime(n):
while True:
for i in range(2,n):
if n%i==0:
return n Output:
13 Happy Coding! Follow us on Instagram @programmersdoor Join us on Telegram @programmersdoor Please write comments if you find any bug in above code/algorithm, or find other ways to solve the same problem. Follow Programmers Door for more. #blog #interview #placement #learn #computer #science

        Contact Us

  • LinkedIn
  • Facebook
  • Instagram

©2023 by Programmers Door