Powered by Blogger.

Get missing number from the range of numbers (1-100, 20-400)


We have a series of numbers like 1 to 100 how we'll get if there one number is missing?
e.g. numbers = range(1,100), missing = ? how could we found the ? number.

Ans.

Since the numbers are in A.P. series then the sum of all numbers will be

Sn = (a+l)*n/2

Here a: first number, l: last number, n: number of terms

so, if range  = (1,100)
then Sn = (1+100)*100/2 = 5050
now found the sum of given numbers by iterating and summing them lets assume the sum is 5031

then the missing number = 5050-5031 = 19

No comments