Reputation: 21
I was creating a program that would take numbers in a file and average them and create the standard deviation; however, when I compile the program I get an error stating Unclassifiable statement at (1) which in the compiler it is located right under the do while statement. Does anyone have any input as to why this is? I am led to believe that I have incorrect syntax but not sure where.
implicit none
!declaring the single precision for real numbers, array, and variables.
integer :: firstnumber, i
real*4 :: average, sum_, standarddeviation
real*4, allocatable :: arrayone(:)!making sure that the array is single precision real
open(1,file='Numbers1.txt')!opening file
do i = 1, 10
read(1,*) firstnumber!reading the first number
end do
allocate(arrayone(firstnumber))!allocating the array with the first number variable obtained from previous statement
i = 2
do while i < 60000
i = i + 1
read(i,*)
sum_ = Sum(arrayone) !sums all of the numbers from arrayone
average = Sum_/float firstnumber !calculates the average or mean of the data set
standarddeviation = sqrt(sum_ - average) * (sum_ - average)!calculates the standard deviation of the data set
print,"Average = "average
print,"Standard Deviation = "standarddeviation
deallocate(arrayone)!Deallocating arrayone}
close(1)
print*,"Done!"
end program Assignmentthree
Upvotes: 0
Views: 44