@Sanjay Sharma can you give an example to support your point and why we should not use floor??
@abir_banerjee e.g total numbers divisible by 7 between 6 and 498 are 71 (first if 7 and last is 497 ) but floor[(498-6)/7] will give 70
and if we use a.p,. formula
7+(n-1)7=497 gives n=71
this Question can also be solved using a probability approach. See this variant https://gateoverflow.in/314348/gate-cse-1995-question-25b, and check out the answer by @techbd123 and read in his comments, to know.
64.3k questions
77.9k answers
244k comments
80.0k users