	real mean		!would have been an integer
	real x(51)
	character r*1

1	print 103
103	format('Do you want to read a data file? [Y/N] ',$)
	read *,r
	if(r.eq.'n'.or.r.eq.'N')stop

	open(unit=10,file='my_file.dat',status='old')
	do i=1,51
		read(10,*,end=666) x(i)
	enddo

	print*,'ERROR - 50 points maximum!'
	close(unit=10)
	goto 1

666	n=i-1

	print 100,n
100	format('I read the following ',i2,' data points:')

	sum=0
	sum2=0
	do  i=1,n
		print 101,i,x(i)
101		format(i2,'th data point = ',1pg15.7)
		sum=sum+x(i)
		sum2=sum2+x(i)**2
	enddo

	sdev1=sqrt( (sum2-(sum**2)/n)/(n-1) )
	mean=sum/n

	sdev2=0
	do i=1,n
		sdev2=sdev2+(x(i)-mean)**2
	enddo

	sdev2=sqrt(sdev2/(n-1))

	print 102,mean,sdev1,sdev2
102	format(1x,'mean= ',g15.7,' standard deviation method 1 = ',g15.7,/t24,
     1    'standard deviation method 2 = ',g15.7)
C
C the two methods start to differ when (sdev/mean)<2e-4
C
	end
