Question: In this lab, students will practics how to use recursive subroutines in Fortran 90 programs. Write and test a recursive subroutine PrintReverse that accepts an

 In this lab, students will practics how to use recursive subroutines

In this lab, students will practics how to use recursive subroutines in Fortran 90 programs. Write and test a recursive subroutine PrintReverse that accepts an integer and displays it in reverse order. The program is as follows, but the subroutine is missing. Hint: For an integer n, we can print the reverse order of n as follows. First print the last digit of n and then print other digits (which is n/10) in reverse order. program testPR. implicit none integer :: n print *, "this program test a subroutine PrintReverse" write (*, ' (1x, a), advance = "NO") "input a positive integer n: " read *, n print *, "The number ",n, "in reverse order is:" call PrintReverse(n) contains recursive subroutine PrintReverse (n) end subroutine PrintReverse end program testPR

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!