You are on page 1of 2

Project Name

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)

Then the status of each number in the range is:

7 is prime

8 is composite or not prime

9 is composite

10 is composite

Count: 1 prime and 3 composite numbers in the range.

Name of the group: Server Monks

Group Members name : Aman Ranjan : 12217778 , Rishabh Kumar


Chaubey : 12217709 , Dhaval Bansal : 12217674

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

Count: 1 prime and 3 composite numbers in the range

You might also like