O PROBLEMA DINTRE 3,4,5
PE C++
VA ROG REPEDE!!! DAU COROANA!
Răspunsuri la întrebare
3.
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<=sqrt(n);i++)
if((n%i==0)&&(n/i==i))
cout<<"NU",return 0;
cout<<"DA";
}
SAU
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
if(sqrt(n)==floor(sqrt(n))
cout<<"DA";
else
cout<<"NU";
}
4.
#include <iostream>
#include <boost/math/common_factor.hpp>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<boost::math::lcm(a,b);
}
SAU
#include<iostream>
using namespace std;
int main(){
int a,b,x,y;
cin>>a>>b;
x=a,y=b;
while(x!=y)
if(x>y)
x=x-y;
else
y=y-x;
cout<<(a*b)/x;
}
5.
#include<iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
for(int i=1;i<=a;i++)
if(a%i==0&&b%i==0)
cout<<i<<' ';
}