Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of an integer N.
Output:
For each test case in a new line print the number of divisors.
Number of Divisors Hackerrank Solution in C++
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n, i, count = 0;
cin >> n;
for (i = 1; i <= n; i++)
{
if (n % i == 0)
{
if (i % 3 == 0)
{
count++;
}
}
}
cout << count << endl;
}
return 0;
}
0 Comments: