0% found this document useful (0 votes)
8 views4 pages

Sub

The document contains the definitions for multiple functions in C++ with different purposes like calculating factorials, checking if a number is a palindrome, computing distances between two points and more. It defines functions to perform operations on integers like multiplication, extracting roots, checking properties of numbers and more.

Uploaded by

Matei Rus
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)
8 views4 pages

Sub

The document contains the definitions for multiple functions in C++ with different purposes like calculating factorials, checking if a number is a palindrome, computing distances between two points and more. It defines functions to perform operations on integers like multiplication, extracting roots, checking properties of numbers and more.

Uploaded by

Matei Rus
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/ 4

#include iostream

#include cmath
using namespace std;
int multiplu(int a,int k)
{
int i=1;
while(aik)
{
i++;
}
return ik;
}
int radical(int a,int &x)
{
x=1;
while(xx=a)
{
x++;
}
return x-1;
}
void fibo(int n,int &v)
{
int next=0,t1=0,t2=1;
for(int i=1;i=n;i++)
{
if(i==1)
i++;
if(i==2)
coutt2 ;
next=t1+t2;
t1=t2;
t2=next;
if(next%2!=0)
coutnext ;
}
}
int verif(int x)
{
int i=0;
while(x)
{
if(x%10!=0)
i++;
else
i=0;
if(i=3)
return 1;
x=x10;
}
}
void diviz(int n,int a[])
{
int k=0;
for(int i=1;i=n;i++)
{
for(int j=1;j=n;j++)
if(a[i]%a[j]==0 && i!=j)
{
couta[i] a[j] ; ultima e in plusA(4 e de doua opri)
k++;
}

}
coutk;
}
int sfx(int x)
{
int k=0;
int y=x%10000;
while(y)
{
if(y10%10y&10)
k++;
else
return 0;
if(k==3)
return 1;
}
return 0;
}
int calcul(int n,int k)
{
int i=1;
while(n)
{
if(i==3)
return n%10;
else
i++;
n=n/10;
}
}
int dist2(int xa,int ya,int xb,int yb)
{
int d;
d=((xb-xa)*(xb-xa))+((yb-ya)*(yb-ya));
return d;
}
void calcul2(int n, int &x)
{
int p=1;
x=0;
while(n)
{
if((n%10)%2==0 && x==0)
{
x=x+p*(n%10);
p=p*10;
}
else
if((n%10)%2==0 && x!=0)
{
x=x*10+n%10;
}
n=n/10;
}
cout<<x;
}
int palindrom(int n)
{
int p=1,og=0,m;
m=n;
while(m)
{
if(og==0)
{
og=og+m%10*p;
p=p*10;
}
else
if(og!=0)
{
og=og*10+m%10;
}
m=m/10;
}
if(n==og)
return 1;
else
return 0;
}
void ecuatie(int a,int b,int c)
{
int delta,x1,x2;
delta=sqrt(b*b-(4*a*c));
x1=(-b+delta)/(a*2);
x2=(-b-delta)/(a*2);
if(x1!=x2 && (x1>0||x2>0))
{
if(x1>x2)
cout<< x1;
else
if(x1<x2)
cout<< x2;
}
else
if(x1==x2 && x1>0)
cout<< x1;
else
cout<<"-3200";
}
int cautare(int n,int x[],int v)
{
int p=0;
for(int i=2;i<=n;i++)
{
if(x[i-1]<v<x[i])
{
p=i;
for(int j=i+1;i<=n;j++)
x[j]=x[i++];
return p;
}
}
}
void ultimacifra(int a,int b)
{
int p=a;
while(b>1)
{
a=a*p;
b--;
}
cout<<a%10;
}
int s(int n,int c,int &k)
{
k=0;
while(n)
{
for(int i=c-1;i<=c+1;i++)
{
if(n%10==i)
{
k++;
cout<<i<<" ";
}

}
n=n/10;
}
if(k==0)
cout<<"0";
else
cout<< k;
}

You might also like