#Write an efficient program to find the double factorial of k written as k!!. import sys import time f=open('in1_5.txt','r') n=int(f.readline()) f.close() t1=time.clock() def fac(n): global no_mul if(n<=3): return n fact= n*fac(n-2) no_mul=no_mul+1 return fact no_mul=0 fact=fac(n) t2=time.clock() t=t2-t1 mem=sys.getsizeof(fact)+sys.getsizeof(no_mul)+sys.getsizeof(n) f1=open('out_15_sec1_5.txt','w') f1.write("%d!!=%d \nno. of multiplications=%d \ntime taken="%(n,fact,no_mul)) f1.write(str(t)) f1.write("seconds\nmemory used=%d bytes"%mem) f1.close()