Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- long long total1 = 0, total2 = 0, i = 0;
- double simulation_time = 0;
- clock_t Start = clock();
- do
- {
- total1 += i + i;
- total2 += i * i * i * i;
- i++;
- } while (i < 1000000000);
- clock_t End = clock();
- printf("Total 1 = %u n", total1);
- printf("Total 2 = %u n", total2);
- simulation_time = (double)(End - Start) / CLOCKS_PER_SEC;
- printf("Runtime of Whole Simulation using clock_t: %fn", simulation_time);
- return 0;
- }
Add Comment
Please, Sign In to add comment