![]() Whoever wrote that has confused an IDE with a programming language. Is that too tricky for a Wikipedia article? Write (*,'(a,g12.4)') 'Average of negative points = ', negative_average Write (*,'(a,g12.4)') 'Average of positive points = ', positive_average Negative_average = sum(points, points < 0.) / count(points < 0.) Negative_average = sum(points, points 0) thenĪverage_points = sum(points) / number_of_points ![]() Positive_average = sum(points, points > 0.) / count(points > 0.) ! Now form average over positive and negative points only If (number_of_points > 0) average_points = sum(points) / number_of_points ! Take the average by summing points and dividing by number_of_points Write (*,*) "Enter the points to average:" Write (*,*) "Input number of points to average:" ![]() Real, dimension(:), allocatable :: points ! While this may not be desired behavior, it keeps this example simple ! As written, if there are no data points, an average of zero is returned ! Read in some numbers and take the average Looking at the article, I see this code at the end: program average The section headings of the Wikipedia Fortran entry have been revised, in particular the concept of ‘Modern Fortran’ is now introduced. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |