|Artificial Intelligence Tutorial|
|Machine Learning Projects Tutorial||Python Video tutorial|
|Computer Graphics Video Tutorial||C++ Video Tutorial|
|Big Data Analytics Video Tutorial||Soft Computing Video Tutorial|
|Placement Video Tutorial||Java Video Tutorial|
Python program to check whether the given number is prime or not
Write a Python program to accept a number from the user, and check whether the given number is a Prime Number or Not
What is the meaning of a Prime Number..?
A number is said to be prime if it is not divisible by any other number except by 1 and itself.
2, 3, 5, 7, and so on are prime numbers
4, 6, 8, 10, 12, 15, and so on are not prime numbers
Source Code of Prime Number Program in Python
num = int (input("Enter the number: ")) flag = 0 for i in range(2, num): if (num % i == 0): flag = 1 break if (flag == 0): print("The number is prime") else: print ("The number is not a prime")
Enter the number: 66
The number is not a prime
Enter the number: 67
The number is prime
This tutorial discusses how to write a Python program to verify a number is prime or not. If you like the tutorial share it with your friends. Like the Facebook page for regular updates and YouTube channel for video tutorials.