Advertisement
mostlabs

4/1

Dec 5th, 2019
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.    
  9.    
  10.     int a , b , sum=0;
  11.    
  12.    
  13.     cout << "a:" ;
  14.     cin >> a;
  15.     cout << "b:";
  16.     cin >> b;
  17.    
  18.     for(int i=a ; i < b ; i++){
  19.        
  20.     for(int j=1; j <= i ; j++){
  21.        
  22.         if(i%j == 0)
  23.         sum+=j;
  24.     }
  25.     }
  26.    
  27.    
  28.     cout << sum;
  29.    
  30.     return 0;
  31.    
  32.    
  33.    
  34.    
  35.    
  36.    
  37.    
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement