fork download
  1. #include <iostream>
  2. #include <math.h>
  3. #include <time.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int iters = 100;
  10. double a = 0;
  11. int c=clock();
  12. for (int q = 0; q < iters; q++)
  13. for (int i = 0; i < 100000; i++)
  14. if (i%2 == 0) a+= sin(i); else a -= sin(i);
  15. int t=clock()-c;
  16. cout << "Result: " << a << ", time: " << (double)t/CLOCKS_PER_SEC <<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.62s 2852KB
stdin
Standard input is empty
stdout
Result: -56.4002, time: 0.62