We are given an excel sheet which contains integers from 1 to 50, including both. However, the numbers are in a jumbled form and there is 1 integer missing. You have to write a code to identify the missing integer. Only the logic is required.
We know that the sum of all the numbers from 1 to n is (n*(n+1)/2)
Therefore, sum of all the numbers from 1 to 50 is
50*(50+1)/2 (Here, n = 50) = 50*(51)/2 = 25*51 = 1275.
Therefore, all we need to do is to sum all the integers present in the file and subtract the sum from 1275. The difference between 1275 and this sum would give us the missing integer.
See this for code.
This puzzle is contributed by Feroz Baig. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 38 | (Tic Tac Toe Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | Elevator Puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle | Man fell in well Puzzle
- Puzzle 15 | (Camel and Banana Puzzle)
- Find temperature of missing days using given sum and average
- Puzzle 2 | (Find ages of daughters)
- Puzzle 8 | (Find the Jar with contaminated pills)