Prime Number Checker in Python | Python Program | Python Shorts | Coding Shorts | Shorts

preview_player
Показать описание
-The user is prompted to enter a number.
-If the number is greater than 1, the program enters the loop to check for divisors.
-The loop iterates from 2 to half of the number (int(num/2)+1).
-For each iteration, it checks if the number is divisible by the current value of i.
-If the number is divisible, it means the number is not prime, and the program prints that it is not a prime number.
-The program then breaks out of the loop.
-If the loop completes without finding any divisors, the program prints that the number is a prime number.
-If the number is less than or equal to 1, the program directly prints that it is not a prime number.
Рекомендации по теме
visit shbcf.ru