Answer to Question #218529 in Python for Saikumar

Question #218529

You are given a positive integer N. Your task is to find the number of positive integers K <= N such that K is not divisible by any of the following numbers 2, 3, 4, 5, 6, 7, 8, 9, 10


Input

The first line of input is an integer N.



Output

The output should be an integer representing the number of positive integers satisfying the above condition.


Explanation

In the given example,

11 is not divisible by any number from 2 to 10. It is divisible by only 1, 11.So, the output should be 2.


Sample Input : 12

Sample output: 2


Sample Input: 200

Sample output: 47


Sample Input : 10

Sample output: 1




1
Expert's answer
2021-07-19T02:44:48-0400
# enter the numper
n = int(input("Enter the number: "))
number = 0
for i in range(1,n+1):
    if i % 2 != 0 and i % 3 != 0 and i % 4 != 0 and i % 5 != 0 and i % 6 != 0 and i % 7 != 0 and i % 8 != 0 and i % 9 != 0 and i % 10 != 0:
        number += 1
print(number)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

SS
19.07.21, 10:16

Great..!..Thank you :)

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS