Number of divisors EASY Subprograme (BAC) 10 XP 0 solved
Mobile coding works. A laptop is faster for long sessions.

Problem

Write the definition of a subprogram `nrDiv` that receives through parameter `n` a non-zero natural number (`1 <= n <= 1.000.000`) and returns the number of natural divisors of `n`. Then write a main program that reads from standard input a non-zero natural number `t`, then `t` non-zero natural numbers, one per line or separated by spaces. For each of the `t` numbers, the program prints on a separate line the value returned by the call to subprogram `nrDiv` for that number.

Input format

Input input.txt

The first line contains the natural number `t`. The following lines contain `t` non-zero natural numbers, separated by spaces or newlines. - `1 <= t <= 100` - `1 <= x <= 1.000.000` for each number read - the subprogram `nrDiv` must be defined explicitly and called from `main`

Output format

Output output.txt

The program prints `t` lines, each containing the number of divisors of the corresponding input number, in reading order.

Example

input
5
12 1 7 100 36
output
6
1
2
9
9

Ready to solve this challenge?

Create a free account to write code, submit solutions, and track your progress.

⌨️ Keyboard Shortcuts

Code Editor
Run Code
Ctrl Enter
Submit Code
Ctrl Shift Enter
Format Code
Shift Alt F
Toggle Comment
Ctrl /
Undo
Ctrl Z
Redo
Ctrl Y
Navigation
Global Search
/
Show Shortcuts
?
Close Modal
Esc

🔍 Interactive Debugger

0 / 0

Analyzing your code...

📦 Variables

No variables yet

📚 Call Stack
main() line 1
📤 Output
We use cookies

Essential cookies are always active. You can choose to enable preference and analytics cookies. Learn more