Question: #include using namespace std; string ltrim(const string &); string rtrim(const string &); /* * Complete the 'divisors' function below. * * The function is expected

 #include using namespace std; string ltrim(const string &); string rtrim(const string

#include

using namespace std;

string ltrim(const string &);

string rtrim(const string &);

/*

* Complete the 'divisors' function below.

*

* The function is expected to return an INTEGER.

* The function accepts INTEGER n as parameter.

*/

int divisors(int n) {

}

int main()

{

ofstream fout(getenv("OUTPUT_PATH"));

string t_temp;

getline(cin, t_temp);

int t = stoi(ltrim(rtrim(t_temp)));

for (int t_itr = 0; t_itr

string n_temp;

getline(cin, n_temp);

int n = stoi(ltrim(rtrim(n_temp)));

int result = divisors(n);

fout

}

fout.close();

return 0;

}

string ltrim(const string &str) {

string s(str);

s.erase(

s.begin(),

find_if(s.begin(), s.end(), not1(ptr_fun(isspace)))

);

return s;

}

string rtrim(const string &str) {

string s(str);

s.erase(

find_if(s.rbegin(), s.rend(), not1(ptr_fun(isspace))).base(),

s.end()

);

return s;

}

Watson gives an integer N to Sherlock and asks him: What is the number of divisors of N that are divisible by 2?. Input Format First line contains T, the number of testcases. This is followed by T lines each containing an integer N. Output Format For each testcase, print the required answer in one line. Constraints 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!