Print number of multiples of a given number Using Python

Posted on | Sunday, 14 May 2023 | No Comments

 Given a positive integer - N, print the number of multiples of 3, 5 between [1, N].

Input Format

First and only line of input contains a positive integer - N.

Constraints

1 <= N <=1018

Output Format

Print the number of multiples of 3, 5 in range of 1 to N.

Sample Input 0

12

Sample Output 0

6
n = int(input())

count_3 = n // 3
count_5 = n // 5
count_lcm = n // 15

print(count_3 + count_5 - count_lcm)

Comments

Leave a Reply

Search

Followers