Dsa
Math
Medium
Divisor Count Function
Write a program that takes a positive integer n and calculates the number of divisors of n, including 1 and n itself.
Input Format:
A single positive integer n (1 <= n <= 10^6).
Output Format:
An integer representing the number of divisors of n.
Example:
Input:
12
Output:
6
Key concepts
divisorcountmath
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