Math, asked by hanirvesh5067, 1 year ago

Given three numbers n, a and b. Find how integers in range from 1 to n are divisible by a or b.

Answers

Answered by saimanohar37
0
Given three numbers N, A and B. Find how integers in range from 1 to N are divisible by Aor B.

Input:
Input contains three integers N, A and Bseparated by space.

Output:
Print total numbers of integers in range from 1to N are divisible by A or B.

Constraints:

Test Files 1 to 5: 
1<=N<=100 
1<=A<=100
1<=B<=100

Test Files 6 to 10
1<=N<=1012
1<=A<=105
1<=B<=105

SAMPLE INPUT

 

25 3 5

SAMPLE OUTPUT

 

12

Explanation

N= 25 , A = 3 and B= 5

12 numbers which are divisible by 3 or 5 in range 1 to N are given below:
3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25

Similar questions