write a program in qbasic to enter two numbers . subtract the second number from the first number if the first number is greater than the second number or vics-versa
aishwaryash321:
If the second number is greater than what to do?
Answers
Answered by
45
The required program is:
CLS //Clears the screen
INPUT “ENTER YOUR FIRST NUMBER”; A
INPUT “ENTER YOUR SECOND NUMBER”; B
IF B > A THEN // If 2nd number is greater
C = B - A // then subtracting 2nd number from 1st number.
ELSE
C = A - B // else 1st number - 2nd number
PRINT “DIFFERENCE OF TWO NUMBERS”; C
END
Answered by
18
Answer:
CLS
INPUT"Enter two numbers";A,B
S=A-B
PRINT"The Difference=";S
ELSE
P=B-A
PRINT"The Difference=";P
END IF
END
Similar questions