Write a Fortran program that will calculate the sum and average of 9 number.
I am not going to my attic to find my boxes full of cards punched with Fortran commands.
I will say how I would go about it though
define an array of numbers of size 9 (you did not say if they were whole numbers)
read the 9 numbers and store them in that array
say i = 0
say sum = 0
add them in a loop from i = 1 to i = 9
sum = sum + number (i)
after i = 9, leave the loop
say av = sum/9
print numbers 1 through 9
print sum = sum
print average = av
end
Please know that you will not learn how to do this if someone else does your work for you.
DIM X(9)
SUM=0
DO N=1,9
SUM=SUM+X(I)
CONTINUE
AVG = SUM/9
pretty it up as you will
Sure! Here's an example program in Fortran that calculates the sum and average of 9 numbers:
```fortran
program sum_and_average
implicit none
integer :: i, num
real :: sum, average, number
! Initialize variables
sum = 0.0
! Read in 9 numbers
do i = 1, 9
write(*, '(a, i2)') 'Enter number ', i
read(*, *) number
sum = sum + number
end do
! Calculate the average
average = sum / 9.0
! Print the sum and average
write(*, '(a, f6.2)') 'Sum : ', sum
write(*, '(a, f6.2)') 'Average: ', average
end program sum_and_average
```
To run this program, you'll need a Fortran compiler installed on your computer. Once you have a compiler, you can save the code above in a file with a `.f90` or `.f95` extension (for example, `sum_and_average.f90`), and then compile and run it as follows:
```
$ gfortran sum_and_average.f90 -o sum_and_average
$ ./sum_and_average
```
The program will prompt you to enter 9 numbers, and then it will calculate and display the sum and average.