I'm currently taking my first programming course, and in one of the assignments, I was asked to trace the following Fortran77 program fragment by hand and determine the final values for n and m:
integer n, m, k, j n = 0 m = 0 do k = 1, 3 do j = k, 1, -1 n = n + j end do m = m + k end do print*, n print*, m
I was only able to get this far:
n m k j
0 0 1 1
1 1 2 0
3 3 3 2
How should I approach it from here?


Sign In
Create Account

Back to top









