10-02-2004, 01:25 AM
Well, im new to QBASIC... And I was hoping you guys could help me out... What i want to do is divide the larger of the numbers by the smaller... But someone might put in zero.... So I need to figure out why it keeps saying that all numbers = zero, when they dont. Please Please help me out on this guys!! Every thing works fine eccept the zero part....
Thanks!! Ref
I just realised I can put
But i would like to use the "OR" why wont it work with the or?
Thanks!! Ref
Code:
REM woooOOoooo
CLS
PRINT "After the ? Appears please enter two number separated by a comma and hit enter. The Larger number will be divided by the smaller number"
PRINT TAB(2) "A" TAB(15) "B" TAB (30) "A/B" TAB(45) "B/A"
PRINT TAB(0) "---" TAB(14) "---" TAB(29) "-----" TAB(44) "-----"
40 FOR j = 1 TO 13
INPUT a, b
[b]IF a OR b = 0 THEN 30[/b]
IF a > b THEN 10
IF a < b THEN 20
NEXT J
10 c = a / b
PRINT TAB(2) a TAB(15) b TAB(30) c
IF a > b THEN 40
20 d = b / a
PRINT TAB(2) a TAB(15) b TAB(30) d
IF a < b THEN 40
30 PRINT TAB(2) a TAB(15) b TAB(30) "Division by zero not defined
IF a OR b = 0 THEN 4
I just realised I can put
Code:
IF a = 0 THEN 30
IF b = 0 THEN 30