You are viewing a single comment's thread. Return to all comments →
Here i wrote the code without using any array or vector
int total = 0; if(a[(a.length-1)]<b[0]){ for(int i=a[(a.length-1)]; i<b[0]+1; i++){ int c=0; for(int j=0; j<b.length; j++){ if(b[j]%i==0) c++; } if(c==b.length){ int c1=0; for(int k=0; k<a.length; k++){ if(i%a[k]==0) c1++; } if(c1==a.length){ total++; } } } } else{ for(int i=b[0]; i<a[(a.length-1)]+1; i++){ int c=0; for(int j=0; j<b.length; j++){ if(b[j]%i==0) c++; } if(c==b.length){ int c1=0; for(int k=0; k<a.length; k++){ if(i%a[k]==0) c1++; } if(c1==a.length){ total++; } } } } return total;
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
Here i wrote the code without using any array or vector