clc close filen='c:/usr/abc_no_n.txt' fh=fopen(filen,'r') % r to read % w to write % a to append i=0 a=' ' while ischar(a)==true a=fgets(fh) if ischar(a)==true b=sscanf(a,'%f %f') i=i+1 fprintf('i a b', i,a,b) x(i)=b(1) y(i)=b(2) end end sumx=0 for i=1:1:n sumx=sumx+x(i)*y(i) end filewr='c:\usr\output.txt' fl=fopen(filewr,'w') fprintf (fl,'th value of the summation is %f',sumx)