fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int getTotalX()
  5. {
  6. int a[2]={2,6};
  7. int b[2]={24,26};
  8. int n=2,m=2;
  9. int nums=0,i,j;
  10. for(i=1;i<=100;i++)
  11. {
  12. //first loop for checking common multiples of a[]
  13. j=0;
  14. while(j<n && i%a[j]==0)
  15. j++;
  16.  
  17. //after getting common multiples, checking if they are multiple of b[]
  18. if(j==n)
  19. {
  20. j=0;
  21. while(j<m && b[j]%i==0)
  22. j++;
  23.  
  24. if(j==m)
  25. nums++;
  26. }
  27. }
  28. return nums;
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34. cout<<"Result: "<<getTotalX();
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0.01s 5516KB
stdin
Standard input is empty
stdout
Result: 0