fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int a, b, wynik=0;
  7. cin >> a >> b;
  8.  
  9. for (int i=0; i < (1+(b-a)); i++) {
  10. wynik += (a+i)*(a+i);
  11. }
  12.  
  13. cout << wynik << endl;
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 3344KB
stdin
5 6
stdout
61