C Program to calculate the total execution time of a program.

Measuring program execution time in C helps you benchmark algorithms and quantify how long different approaches take. The standard tool is the clock() function from <time.h>, which measures CPU time consumed by the program — not wall-clock time. Two snapshots (before and after) divided by CLOCKS_PER_SEC give you the elapsed time in seconds. clock() and …