Computer Science, asked by akshitachinni663, 3 months ago

Wait a python program to print the
count prime and composite
number until
entered number is
the
of​

Answers

Answered by samarthkrv
0

Answer:

import math

def isPrime(n):

   for i in range(2 , n):

       if(n % i == 0):

           return False

   return True

def countPrime(ran):

   pc = 0

   for i in range(2,ran):

       if(isPrime(i)):

           pc+=1

   return pc

ran = int(input("Enter the range of numbers:"))

print("The number of prime numbers between 2 and" , ran , "is" , countPrime(ran))

Explanation:

Similar questions