Write a program to find prime numbers between two range excluding the starting and ending number of given range
Input 1: Lower Range
Input 2: Upper Range
Output:
List of prime numbers
n1=int(input("Enter the lower range: ")) n2=int(input("Enter the upper range: ")) list=[] for i in range(n1+1,n2): X=0 for j in range(2,11): if (i%j==0): X=X+1 break if (X==0): list.append(i) print("Prime numbers between {} and {} are:".format(n1,n2)) for i in range(len(list)): print(list[i])
Input_1:
Enter the lower range: 17
Enter the upper range: 23
Output:
Prime numbers between 17 and 23 are:
19
Input_2:
Enter the lower range: 11
Enter the upper range: 31
Output:
Prime numbers between 11 and 31 are:
13
17
19
23
29
Scrshot:
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer