How do I distinguish one version of Fortran from another?
Michael C.
answered 04/17/21
Research Assistant in Computational Science PhD program
This can be done by initializing an array to have the odd integers less than 100, then using the intrinsic function SUM(x):
program sum_odds
integer, dimension(50) :: odds = [ (2*i-1, i=1,50) ] !Initialize array with odd integers using implied DO loop
write(*,*) sum(odds) !prints sum of elements in array to screen
end program sum_odds
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.