0% found this document useful (0 votes)
6 views5 pages

Atestatc

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Atestatc

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

#include <fstream>

#include <iostream>
using namespace std;
ifstream fin ("date.in");
int x,y,n;
int sumadiv(int x)
{
int i,s=0;
for(i=1;i<x;i++)
{
if(x%i==0)
s=s+i;
}
return s;
}

int main()
{
fin>>n;
while(fin>>x)
{
fin>>y;
if(sumadiv(x)==y+1&&sumadiv(y)==x+1)
cout<<x<<" "<<y<<endl;
}

return 0;
}

#include <iostream>
#include <fstream>
using namespace std;
int n,x,nr,p=1,z=3361,nrz,c;
ifstream fin ("date.in");
int primacifra(int x)
{
while(x>9)
{
x=x/10;
}
return x;
}

int main()
{
fin>>n;
while(fin>>x)
{
nr=nr*10+primacifra(x);
}
if(nr%3==0)
cout<<"da";
else
cout<<"nu";
cout<<endl;
p=1;
while(z!=0)
{
c=z%10;
z=z/10;
if(c%2!=0)
{
nrz=nrz+c*p;
p=p*10;
}
nrz=nrz+c*p;
p=p*10;
}
cout<<nrz;

return 0;
}

#include <fstream>
#include <iostream>
using namespace std;
int n,x,ok=0;
ifstream fin ("date.in");

int nr1(int x)
{
int cb,nr=0;;
while(x!=0)
{
cb=x%2;
x=x/2;
if(cb==1)
nr++;
}
return nr;
}

int nr0(int x)
{
int cb,nr=0;;
while(x!=0)
{
cb=x%2;
x=x/2;
if(cb==0)
nr++;
}
return nr;
}

int main()
{
fin>>n;
while(fin>>x)
{
//cout<<nr1(x)<<" "<<nr0(x)<<endl;
if(nr1(x)==nr0(x))
{
cout<<x<<" ";
ok=1;
}
}
if(ok==0)
cout<<"nu exista";

return 0;
}

#include <iostream>
#include <fstream>
using namespace std;
int x,nr=0,i,nrd,z;
ifstream fin ("date.in");

int cifractrl(int x)
{
if(x%9==0)
return 9;
else
return x%9;
}

int main()
{
while(fin>>x)
{
z=cifractrl(x);
nrd=0;
for(i=1;i<=z;i++)
if(z%i==0)
nrd++;
if(nrd==2)
nr++;

}
if(nr==0)
cout<<"nu exista";
else
cout<<nr;

return 0;
}

#include <iostream>
#include <fstream>
using namespace std;
int x,y,n,c;
ifstream fin ("date.in");

int cmmdc(int x,int y)


{
int r;
r=x%y;
while(r!=0)
{
x=y;
y=r;
r=x%y;
}
return y;
}

int main()
{
fin>>n;
while(fin>>x)
{
fin>>y;
c=cmmdc(x,y);
cout<<x/c<<" "<<y/c<<endl;
}

return 0;
}

#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int x,n,nr;
ifstream fin ("date.in");

int nrputernic(int x)
{
int nr,nrn=0,aux,c;
aux=x;
while(aux!=0)
{
aux=aux/10;
nr++;
}
aux=x;
while(aux!=0)
{
c=aux%10;
aux=aux/10;
nrn=nrn+pow(c,nr);
}
return nrn;
}

int main()
{
fin>>n;
while(fin>>x)
{
if(x==nrputernic(x))
nr++;
}

if(nr==0)
cout<<"nu exista";
else
cout<<nr;
return 0;
}

#include <fstream>
#include <iostream>
using namespace std;
int a[100][100],n,i,j,maxx,nr;
ifstream fin ("date.in");

int elementmax(int x)
{
int i,j,maxx=0;
for(i=0;i<n;i++)
{
if(a[x][i]>maxx)
maxx=a[x][i];
}
return maxx;
}

int main()
{
fin>>n;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
fin>>a[i][j];

for(i=0;i<n;i++)
{
maxx=elementmax(i);
for(j=0;j<n;j++)
{
if(a[i][j]==maxx)
if(i>=j)
nr++;
}
}
if(nr==0)
cout<<"nu exista";
else
cout<<nr;

return 0;
}

You might also like