Re: coding problem using salford FTN95
From: jan van oosterwijk (jvo_36_at_hotmail.com)
Date: 11/03/04
- Next message: Charles Russell: "Re: GNU Fortran 95: Opinions?"
- Previous message: Kevin: "Sophisticated FORTRAN IDE"
- In reply to: bab: "coding problem using salford FTN95"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 3 Nov 2004 06:58:02 -0800
"bab" <bab@bab.bab> wrote in message news:<cm95gp$pb0$1@titan.btinternet.com>...
> Please help a friend who asked me about programming problem, I know nothing
> about programming.
>
> The problem is that he cannot make it calculate for values less than 0 but
> above it is ok
I just guess that you mean the following :
Richard's suggestions included :-)
Program my_program
implicit NONE
real :: pi, dia = -1.0, length = -1.0, sarea, vol
pi = 4*atan(1.0)
do while(dia < 0.0 .or. length < 0.0)
write(*,*)'diameter of cylinder?'
read(*,*)dia
if(dia < 0.0) print *, "Again"
write(*,*)'length of cylinder?'
read(*,*)length
end do
sarea = pi*dia*length
vol = 0.25 * sarea * dia ! pi*(dia**2)*length/4.0
write(*,*)
write(*,*) 'diameter of cyl. =', dia
write(*,*) 'length of cyl. =', length
write(*,*) 'surface area of cyl. =', sarea
write(*,*) 'volume of cyl. =', vol
stop
end program
> thank you for your time.
You're welcome , [JvO]
- Next message: Charles Russell: "Re: GNU Fortran 95: Opinions?"
- Previous message: Kevin: "Sophisticated FORTRAN IDE"
- In reply to: bab: "coding problem using salford FTN95"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|