You are on page 1of 3

Cel mai mic multiplu comun

#include<iostream.h>
Int a,b;
Int cmmdc(int a, int b)
{if(a==0) return b;
Else if(a<b)return cmmdc(a-b, b);
Else return cmmdc(a, b-a);
}
Int cmmmc (int a, int b)
{cmmmc=(a*b)/cmmdc(a, b);
}
Int main()
{int a,b;
Cout<<a=<<a;
Cout<<b=<<b;
Cout<<cmmmc pentru numerele<<a<<si<<b<<este<<cmmmc;
Return 0 ;

Numarul de cifre

#include<iostream.h>
{int n, k=o ;
While(n!=0)
X=n%10;
K++;
N=n/10;
Return k;}
Int main ()
{int n;
Cout<<n=<<n;
Cout<<Numarul<<n<<are<<k<<cifre;
Return 0;
}

Numar prim
#include<iostream.h>

Int prim(int x, int d)


{if(d==1) return 1;
Else if(n%d==0) return 0;
Else return prim( n, d-1);
}
int main()
{int n;
Cout<<n=<<n;
If(prim(n,n/2)==1) cout<< este prim;
Else cout<<nu este prim;
}

You might also like