Răspuns :
#include <iostream>
using namespace std;
int main()
{
int x=1, k, d, nrd;
cin >> k;
while (nrd!=k)
{
nrd=0;
for (d=1; d<=x; d++)
if (x%d==0) nrd++;
if (nrd==k) cout << x;
else x++;
}
return 0;
}
Răspuns:
#include <iostream>
#include<conio.h>
using namespace std;
int nr_div(int n)
{ int nr_div=1;
if (n == 1)
return nr_div = 1;
for (int i = 1; i <= n / 2; i++) {
if (n % i == 0) {
nr_div = nr_div + 1;
}
}
return nr_div;
}
int main() {
int k,n=1;
cin >> k;
while (k !=nr_div(n))
{
n=n+1;
}
cout << n;
}