fork(1) download
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <math.h>
  4.  
  5. double produceOne()
  6. {
  7. double result = 0;
  8. for (int i = 0; i < 10; ++i)
  9. {
  10. result += 1 / (i * (i + 1));
  11. }
  12. return result;
  13. }
  14.  
  15. int main(void)
  16. {
  17. int a[10000];
  18. int commonCondition = 1;
  19.  
  20. clock_t tStart = clock();
  21.  
  22. for (int i = 0; i < 10000; ++i)
  23. {
  24. if (sin(.78)*sin(.78) + cos(.78)*cos(.78))
  25. {
  26. if (!(i % 2))
  27. {
  28. a[i] = i;
  29. }
  30. else
  31. if (!(i % 3))
  32. {
  33. a[i] = -1;
  34. }
  35. }
  36. }
  37.  
  38. printf("%d\n", produceOne());
  39. printf("Time taken: %fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
  40.  
  41. return 0;
  42. }
  43.  
Runtime error #stdin #stdout 0s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty