Răspuns :

Răspuns:

1.

#include<bits/stdc++.h>

using namespace std;

int main()

{

ifstream f("date.in");

ofstream g("date.out");

int n,nr=0;

f>>n;

for(int i=1;i*i<=n;i++)

{

if(i*i==n)

{

if((i%100)/10==8)

{

g<<i<<" ";

nr++;

}

}

else if(i*i!=n and n%i==0)

{

if((i%100)/10==8)

{

g<<i<<" ";

nr++;

}

if(((n/i)%100)/10==8)

{

g<<n/i<<" ";

nr++;

}

}

}

if(nr==0)

g<<-1;

return 0;

}

2.

#include<bits/stdc++.h>

using namespace std;

int main()

{

ifstream f("date.in");

ofstream g("date.out");

int n;

f>>n;

for(int i=1;i*i<=n;i++)

{

if(i*i==n)

if((i/10)==0)

g<<i<<" ";

else if(i*i!=n and n%i==0)

{

if((i/10)==0)

g<<i<<" ";

if(((n/i)/10)==0)

g<<n/i<<" ";

}

}

return 0;

}

3.

#include<bits/stdc++.h>

using namespace std;

int main()

{

ifstream f("date.in");

ofstream g("date.out");

int n;

f>>n;

for(int i=1;i*i<=n;i++)

{

if(i*i==n and i%2==1)

g<<i<<",";

else if(i*i!=n and n%i==0)

{

if(i%2==1)

g<<i<<",";

if((n/i)%2==1)

g<<i<<",";

}

}

return 0;

}

Explicație: