Translate

Labels

Friday 14 June 2013

PROGRAM TO FIND EXECUTION TIME OF A PROGRAM

#include<time.h>
main()
{
time_t t1,t2;
clock_t clock(void);
int i,x=0,y=10;
t1=clock();

for(i=0;i<10000;i++)
{
x++;
y+=50;
printf("The value of i=%d,x=%d,y=%d\n",i,x,y);
}
t2=clock();
printf("Execution time in seconds:%g\n",difftime(t2,t1)/CLOCKS_PER_SEC);
}


OUTPUT:
Execution time in seconds:1.49

No comments: