/* Author : Michael Robinson Program : timeCounting.c Purpose : To find the time it takes to do something Updated : 06-30-2014 */ #include #include #include void countingTime() { int x = 0; int y = 0; for( x = 0; x < 99999; x++) { printf( "Processing " ); y = y + x; y = y - x; y = y + x; y = y - x; y = y + x; y = y - x; y = y + x; y = y - x; printf( "to count time " ); } } int main() { double startTime = (double)clock(); double elapsed = 0; countingTime(); elapsed = (double)clock() - startTime; printf("\n\ntime elapsed=%.4f seconds\n\n", elapsed/1000); exit(0); //needs #include }