Dsa
Math
Warm-up
Sum of Primes Up to N
Find the sum of all prime numbers up to and including a given positive integer N.
Input format:
- A single line containing a positive integer N.
Output format:
- A single integer representing the sum of all prime numbers up to N.
Example:
Input:
10
Output:
17
Key concepts
mathprimesloops
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now