I was given an assignment to create a program that solves the Josephus Problem (.[/PLAIN] [Broken] the program needs to work for n amount of people, and it must use an array.(adsbygoogle = window.adsbygoogle || []).push({});

Problem:

I need to create a subroutine that will allow the user to read(*,*) n

and create an array that is n big.

Attempt:

subroutine sub(n)

implicit none

integer :: n, i

integer :: array(n)

do i = 1, n

array(i) = 0

end do

end subroutine sub

program arrays

implicit none

integer :: size, i

write(*,*) "how big is your array"

read(*,*) size

call sub(size)

end program arrays

I am stuck, and dont know why this isnt working.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Fortran 90 creating an array of unknown size

Loading...

Similar Threads for Fortran creating array |
---|

Fortran Successive Over Relaxation Method in FORTRAN |

If statement for Monte Carlo integration |

C/++/# How to use C++ in studying calculus |

Fortran How to buy Fortran Programming Software Commersial License |

Fortran Fortran for Computational Fluid Dynamics Problems |

**Physics Forums | Science Articles, Homework Help, Discussion**