The C program the func1 is called N times given as argument #include #include #include long func1(int n){ long r=0; for (int i=1; i<= n;i++) r+= i; return r; } int main(int argc, char* argv[]){ clock_t c0, c1; long v,count; int n; if ( argc < 2) { printf("Number of execution as argument"); return -1; } n=atoi(argv[1]); c0 = clock(); for (int j=0;j < n;j++) v=func1(n); c1 = clock(); printf ("\tCPU time :%.2f sec", (float)(c1 - c0)/CLOCKS_PER_SEC); printf("\n\tThe value : %ld\n", v); } ---------------------------------------------------- Python3 Program executed same number times as C import timeit as it import numpy as np import sys try : n=eval(sys.argv[1]) except: print ("Number of execution as argument"); exit() a=range(1,n+1) b=np.array(a) def func1(): return sum(a) def func2(): return np.sum(b) print(f"sum with Python: {func1()} and NumPy {func2()} ") tm1=it.timeit(stmt=func1, number=n) print(f"time used Python Sum: {round(tm1,2)} sec") tm2=it.timeit(stmt=func2, number=n) print(f"time used Numpy Sum: {round(tm2,2)} sec") ''' Example of execution ./timeC 50000 CPU time :7.66 sec ----------> Consumed by C program The value : 1250025000 python3 timeExe.py 50000 sum with Python: 1250025000 and NumPy 1250025000 time used Python Sum: 33.0 sec ----------> Consumed by Python time used Numpy Sum: 1.13 sec ----------> Consumed by Numpy module '''