Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

#include <iostream>

#include <cmath>
using namespace std;
int n, a[50][50] ;

void citire()
{
cin>>n ;
for(int i=1; i<=n; i++)
for(int j=1; j<=n; j++)
cin>>a[i][j] ;
}

int prim()
{
int ok=1;
for(int i=2; i<=n/2; i++)
if(n%i==0) ok=0 ;
return ok ;
}

int perfect()
{
int s=0 ;
for(int i=1; i<=n/2; i++)
if(n%i==0) s=s+i ;
if(s==n) s=0 ;
return s ;
}

int pp()
{

if(sqrt(n)==int (sqrt(n)))
return 1 ;
else return 0 ;
///int main{ if(pp()==1) cout<<" da " ; else cout<<" nu " ;
}

int cmmdc(int a, int b)


{
int r ;
while (b!=0)
{
r=a%b ;
a=b ;
b=r ;
}
return a ;
}

int cmmmc(int a, int b)


{
return a*b/cmmdc(a,b) ;
}

int sumacifre()
{
int s=0, c ;
while(n!=0)
{
c=n%10 ;
n=n/10 ;
s=s+c ;
}
return s ;
}

int produscifre()
{
int p=1, c ;
while(n!=0)
{
c=n%10 ;
n=n/10 ;
p=p*c ;
}
return p ;
}

int nrcifre()
{
int nr=0 ;
while(n!=0)
{
n=n/10 ;
nr++ ;
}
return nr ;
}

int primacifra()
{
int c, n ;
while (n!=0)
{
c=n%10 ;
n=n/10 ;
}
return c ;
}

int oglinditul()
{
int ogl=0, c ;
while(n!=0)
{
c=n%10 ;
n=n/10 ;
ogl=ogl*10+c ;
}
return ogl ;
}

int palindrom()
{
int ogl=0, c, aux=n ;
while(aux!=0)
{
c=aux%10 ;
aux=aux/10 ;
ogl=ogl*10+c ;
}
if(ogl==n)
return 1 ;
else return 0 ;

int main()
{

You might also like