pls if u can solve this question on fortran pragram 95/2003 as soon as u can it\
ID: 3821778 • Letter: P
Question
pls if u can solve this question on fortran pragram 95/2003 as soon as u can it's on arrays I'm so glad for your help SP2013 Fortran Programming for Engineers program that reads a one dimensional amay A of real variables of siz 10. The program Write a FORTRAN should do the following: Reads the array A that will be entered by the user. C. The program then finds how many numbers in the a greater than zero and how many are less zero C The program finds the average of those greater than zero and those less than zero.Explanation / Answer
real :: numbers(10), pos_total, neg_total,pos_avg,neg_avg
integer :: pos_count, neg_count
pos_count = 0
neg_count = 0
pos_total = 0
neg_total = 0
Print*, “ENTER THE 10 NUMBERS”
Read*, numbers(i)
do i=1,10
If numbers(i)>0 Then
pos_count = pos_count + 1
pos_total = pos_total + numbers(i)
End If
If numbers(i)<0 Then
neg_count = neg_count + 1
neg_total = neg_total + numbers(i)
End If
end do
pos_avg = pos_total / pos_count
neg_avg = neg_total / neg_count
Print*, “The count of positive numbers in the array is”, pos_count
Print*, “The count of negative numbers in the array is”, neg_count
Print*, “The average of positive numbers in the array is”, pos_avg
Print*, “The average of negative numbers in the array is”, neg_avg
end program myarray
Hope this helps you. Thank you.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.