Problem Description
Python Program to Print all the Prime Numbers within a Given Range
Input :
Upper Limit
Output :
Print the prime numbers within the specified limitCODING ARENA
r=int(input())
for a in range(2,r):
k=0
for i in range(2,a//2+1):
if(a%i==0):
k=k+1
if(k<=0):
print(a)
Test Case 1
Input (stdin)15
Expected Output2 3 5 7 11 13
Test Case 2
Input (stdin)40
Expected Output2 3 5 7 11 13 17 19 23 29 31 37
No comments:
Post a Comment