fork download
  1. #include <iostream>
  2. #include <cstdint>
  3.  
  4. template<class T>
  5. T AddFor(T To,T Step = 1){
  6. T R = T();
  7. for (T i = T(); i <= To; i += Step){
  8. R += i;
  9. }
  10. return R;
  11. }
  12.  
  13. int main(){
  14. auto R = AddFor<std::uint64_t>(100000);
  15.  
  16. std::cout << R << std::endl;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
5000050000