Re: coding problem using salford FTN95

From: jan van oosterwijk (jvo_36_at_hotmail.com)
Date: 11/03/04


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]



Relevant Pages

  • coding problem using salford FTN95
    ... Please help a friend who asked me about programming problem, ... write'diameter of cyl. ...
    (comp.lang.fortran)
  • Re: Need An Idea For Teaching VBA
    ... I have Walkenbach's Excel 2007 Power ... programming problem of some sort that could be used in the class. ... "VBA programming" is huge topic. ... that's the programming problem itself, or the teaching time, or both. ...
    (microsoft.public.excel.misc)
  • Re: Critical thinking puzzle
    ... that this seems to be a variant of a "standard" programming problem called the ... >course the macro found the solutions in less than 1 second (not counting ... >programming time) vs an hour or so that I spent doing it the "old fashioned" ...
    (microsoft.public.excel.misc)
  • Re: Theory of programming
    ... I think the Turing machine is a poor model of computation for ... > representation which is 'runnable' but that representation is very far ... can be handy as a way to think about programming in functional languages. ... tremendous useful insight into every programming problem, ...
    (comp.programming)
  • Re: Programming skills - growing from amateur to pro
    ... Jerry Stuckle of comp.lang.php make plain: ... on this or that programming problem. ... The problem with the internet is there are far more poor tutorials ...
    (comp.lang.php)