Computer Science, asked by thiyamronaldo, 6 months ago

write a C program to count no. of multiples of 3 between the two nos.

Answers

Answered by Anonymous
0

Answer:

Given a number n, count all multiples of 3 and/or 5 in set of numbers from 1 to n.

Examples:

Input: n = 6

Output: 3

There are three multiples of 3 and/or 5 in {1, 2, 3, 4, 5, 6}

Input: n = 16

Output: 7

There are two multiples of 7 and/or 5 in {1, 2, .. 16}

The multiples are 3, 5, 6, 9, 10, 12, 15

We strongly recommend to minimize your browser and try this yourself first.

The value of n/3 gives us number of multiples of 3, the value of n/5 gives us number of multiples of 5. But the important point is there are may be some common multiples which are multiples of both 3 and 5. We can get such multiples by using n/15. Following is the program to find count of multiples.

Similar questions