Exercise · Loops · lesson 6 of 8
Exercise: divisor count
Write a function int divisor_count(int n) that returns the number of divisors of n. The divisors are the numbers from 1 to n that divide n with no remainder.
divisor_count(12)→6divisor_count(13)→2divisor_count(1)→1
Constraints: n is from 1 to 10000.
Do not add extra #include lines unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.