Professional Documents
Culture Documents
Python Project Report
Python Project Report
In this project you have to enter a positive integer range [A, B] and system will find out the
status (Prime or composite) of each number available in the given range. At the end print
the count also.
Note: Make use of efficient approach to check prime status of the number.
For example:
Range is (7,10)
7 is prime
9 is composite
10 is composite
Roll no. – 47 , 46 , 45
Code:
count=0
c=0
p=0
for i in range(7,11):
for j in range(2,i):
if i %j== 0:
count=count+1
if count==0:
print(i,"is prime")
count=0
p=p+1
else:
print(i,"is composite")
count=0
c=c+1
print("Count:",p,"prime and",c,"composite numbers in the range.")
Result:
7 is prime
8 is composite
9 is composite
10 is composite