- #1
McAfee
- 96
- 1
Hey guys,
I'm new to fortran and I'm having a slight problem. I put my code below as reference. I first set up a my known values. Then I used an equation to solve for v. After I solve for v I then computed c which involves v.
What I'm now trying to do is to loop the value I got for c back into the equation [c=((r*t)/(p+(a/(v**2))))+b]. So the c would become v and compute a new number.
Any ideas on how I could accomplish that? Thanks for help in advance.
I'm new to fortran and I'm having a slight problem. I put my code below as reference. I first set up a my known values. Then I used an equation to solve for v. After I solve for v I then computed c which involves v.
What I'm now trying to do is to loop the value I got for c back into the equation [c=((r*t)/(p+(a/(v**2))))+b]. So the c would become v and compute a new number.
Any ideas on how I could accomplish that? Thanks for help in advance.
Code:
program homework
open (2, file='output.txt')
a=366*10**3
b=0.0429
p=100
t=300
r=8.3145
DO 1, i=0,5
v=(r*t)/p
c=((r*t)/(p+(a/(v**2))))+b
write(2,*) c
1 continue
end program