Prime numbers:
Test
for prime number
1)
Number should be greater
than 1.
2)
There should not be any
positive divisor other than 1 and itself.
Example: 3,5,7,11,13,17,19 etc
Composite number:
Composite numbers are the natural numbers other than Prime
Numbers.
Other
natural numbers that are not prime numbers are called composite numbers.
Example : 4,6,8,9,10,12,14,15,18,20 etc
Program
:
#Program
for Prime number checking
num
= int(input('Enter a Number for Prime number test:'))
if(num>1):
for i in range(2,num):
if(num%i==0):
print(num,'is not a Prime
Number')
break
else:
print(num, 'is Prime Number')
else:
print(num,"Number is not Prime
Number")
Output:
RESTART:
C:/Users/shrik/AppData/Local/Programs/Python/Python37-32/testprume.py
Enter
a Number for prime number test:5
5
is prime number
>>>
RESTART:
C:/Users/shrik/AppData/Local/Programs/Python/Python37-32/testprume.py
Enter
a Number for prime number test:6
6
is not a prime number
>>>
RESTART:
C:/Users/shrik/AppData/Local/Programs/Python/Python37-32/testprume.py
Enter
a Number for Prime number test:1
1
Number is not Prime Number
>>>