C language get the execution time of a program

www.l‮ruttua‬i.com
C language get the execution time of a program
/*
calculate the execution time of program
*/

#include<stdio.h>
#include<time.h>
int main() {
	int i;
	double total_time;
	clock_t start, end;
	start = clock();
	// start time 
	srand(time(NULL));
	for (i = 0; i < 2500; i++) {
        printf("%d",i);
	}
	end = clock();
	// end time 
	total_time = ((double) (end - start)) / CLK_TCK;
	// calculate the time
	printf("\nTime using: %f", total_time);
	return 0;
}
Created Time:2017-08-28 07:50:21  Author:lautturi