EDUREKA Off-Campus Hiring OA (2024) | Problem Sum of Multiples

Question · Posted Jun 2026

Problem Statement Given a positive integer n, find the sum of all integers in the range [1, n] (inclusive) that are divisible by 3, 5, or 7. Return the calculated sum. Example 1 Input n = 7 Output 21 Explanation Numbers divisible by 3, 5, or 7: 3, 5, 6, 7 Sum: 3 + 5 + 6 + 7 = 21 Example 2 Input n = 10 Output 40 Explanation 3 + 5 + 6 + 7 + 9 + ...

The full answer & interview discussion are available to premium members.

Log in Create a free account