program stat real::x(100),sumx,sumx2,avgx,stdevx integer::n read(*,*)n write(*,*)"Enter",n,"numbers" read(*,*)(x(i),i=1,n) sumx=0 sumx2=0 do i=1,n sumx=sumx+x(i) sumx2=sumx2+x(i)**2 end do avgx=sumx/n stdevx=sqrt(sumx2/n-(sumx/n)**2) write(*,*)"The average is",avgx write(*,*)"The st. dev. is ",stdevx end program stat
To embed this project on your website, copy the following code and paste it into your website's HTML: