Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int i, j, d1, d2, nr1, nr2, nrdiv,maxdiv=-1,a,b;
- cin>>a>>b;
- nr1=nr2=0;
- for(i=a;i<=b;i++){
- nrdiv = 0;
- if(i%2 == 0) nrdiv++;
- for(j=2;j<=i/2;j++){
- if(i % j == 0 && j % 2 == 0){
- nrdiv++;
- }
- }
- if(nrdiv > maxdiv){
- nr1 = nr2 = i;
- maxdiv = nrdiv;
- }else if(nrdiv == maxdiv){
- nr2 = i;
- }
- }
- cout<<maxdiv<<" "<<nr1<<" "<<nr2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement