grades.f90
I suggest you either typed this as it appears into the compiler, or as
an easier way, just copy and paste it!
Note: I do not claim
the program will 100% work, but I give it my best. If it doesn't, try tweaking
it yourself, or email me about it, and I'll modify and post the improved version
later. Good luck!
PROGRAM grades
IMPLICIT NONE
REAL, DIMENSION(4,3) :: students_grades
REAL, DIMENSION(3,4) :: students_grades1
CHARACTER(LEN=20), DIMENSION(4) :: stu
INTEGER :: i, j, k, l
REAL::input_fr_array, sum, average
!Input phase
! DO i=1,4
! PRINT*, "Please enter the student's name?"
! READ*, stu(i)
! PRINT*, "What is his/her first assignment marks?"
! READ*, students_grades(i,1)
! PRINT*, "What is his/her second assignment marks?"
! READ*, students_grades(i,2)
! PRINT*, "What is his/her third assignment marks?"
! READ*, students_grades(i,3)
! PRINT*
! END DO
!Alternative program flow; one where the user do not have to key in data.
!************************8
!Headliners
PRINT*, "These are the grades for the following students:"
PRINT*, "Student's Assignment Assignment Assignment"
PRINT*, "Name 1 2 3 "
PRINT*, "-------------------------------------------------------------"
DO i=1,4
!Counting grades averages
sum=0
DO k=1,3
input_fr_array=students_grades(i,k)
sum=sum+input_fr_array
END DO
average=sum/3
!Record printout
students_grades1=TRANSPOSE(students_grades)
PRINT*, stu(i), students_grades1(1:3,i)
PRINT*, " Average is", average
PRINT*
END DO
PRINT*, "------------------------END OF RECORD------------------------"
END PROGRAM grades