Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (Sesiunea august-septembrie, 26 august 2019)
- 1. #include<iostream>
- #include<cmath>
- using namespace std;
- int produs (int x)
- {
- int p=1, d, r;
- r=sqrt(x);
- for(d=1; d<=r; d=d+2)
- {
- if(x%d==0)
- {
- p=p*d;
- if(p>1)
- {
- return p;
- }
- }
- if(x%(x/d)==0 && d!=x/d)
- {
- p=p*(x/d);
- if(p>x)
- {
- return p;
- }
- }
- }
- return p;
- }
- int MaxImp (int a, int b)
- {
- int i;
- for(i=b; i>=a; i--)
- {
- if(produs(i)>i)
- {
- return i;
- }
- }
- return 0;
- }
- int main()
- {
- int a, b;
- cin>>a>>b;
- cout<<MaxImp(a, b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement