import sys import sys from time import clock num=open("in1_9.txt","r") num1=open("out_9_1_9.txt","w") start= clock() inputf= int(num.readline()) mul=0 add=0 i=1 j=1 fact=0 while i<=inputf: j=i*j ## CALCULATE SUM OF FACT fact=fact+j i=i+1 mul=mul+1 ## CALCULATE THE no. of MULTIPLICATION add=add+2 ## CALCULATE THE NO. OF ADDITION elapsed=clock()-start total=sys.getsizeof(fact)+sys.getsizeof(elapsed)+sys.getsizeof(mul)+sys.getsizeof(add) num1.write("\n"+"fact. of first n no.--:"+str(fact)+"\n"+"time------------------:"+str(elapsed)+"\n"+str("no. of multiplication-:")+str(mul)+"\n"+str("no. of addition-------:")+str(add)+"\n"+str("total size------------:")+str(total)) num.close() num1.close()