Re: TIB: (no subject)
[Prev][Next][Index][Thread]
Re: TIB: (no subject)
:Prompt A,B
:A/B->C
:If C<=.9
:Disp "yes"
:If C>.9
:Disp "no"
That's it. Notice the closing "'s on the Disp's. Also, no then/end is needed as
you only want to execute one statement. However, this is a poor check for a
fraction. What do you mean by a fraction? 99/100 is a fraction, and is greater
than .9...while 101/100 is also a fraction. What exactly are you checking for?
If you want a fraction by me definition, use something like....
Prompt A,B
A/B->C
If fPart(C)==0
Then
Disp "no"
Else
Disp "yes"
End
note that I use two = because I am using an 85....
if you want to know if it is a fraction less than one, use the first set of code,
except change the first test to C<1; and the second to C=>1. NOTE-this does not
provide for negative values. For Instance, by this algorithm, -2 is a fraction.
Bad move, unless you input is restricted. It would help to know exaclty what you
want to do, and what this is for....
Jeremy
Reola920@aol.com wrote:
> The problem: I can't figure out how to write a program that will display or a
> "yes" or "no" if the answer "C" is a fraction. Here's what I have so far.
>
> :Prompt A,B
> :A/B->C
> :If C< or equal to .9
> :Then
> :Disp "no
> :End
> :If C>.9
> :Then
> :Disp "yes
> :End
>
> This is all I can think of on how to do the program. There are problems
> sometimes it kicks out yes and no at the same time. Also, I know there is an
> easier ways to write this, and I would appreciate the help.
Follow-Ups:
References: