f=open("c:\inputs\in4_9.txt",'r') f1=open("out_19_sec4_9.txt",'w') n=int(f.readline()) import time start=time.clock() count=0 ##n=1000 j=0.0 i=1 while(i<=n): j=j+(1.0/i) i=i+1 count=count+1 t1=time.clock()-start import sys ##print("sum of nos.=") +str(j) ##print("time taken=") +str(t1) ##print ("no. of addition=")+str(count) total=sys.getsizeof(n)+sys.getsizeof(count)+sys.getsizeof(i)+sys.getsizeof(j)+sys.getsizeof(t1) ##print "memory taken" + str(total) f1.write("Sum of nos.="+str(j)+"\nTime taken="+str(t1)+("\nNo. of addition=")+str(count)+("\nMemory taken="+str(total))) f.close() f1.close()