2/17/2020

QBASIC Examples

QBASIC Examples

To find sum of two numbers

CLS
REM to find sum of two numbers
INPUT "Enter the first number"; A
INPUT "Enter the second number"; B
LET SUM = A+B
PRINT "The sum of two number is"; SUM
END

CLS
REM to find average of three number
INPUT "Enter the three numbers";A, B, C
LET AVERAGE = (A+B+C)/3
PRINT "The average of three number is "; AVERAGE
END

CLS
REM to find the area of rectangle
INPUT "Enter the length"; L
INPUT "Enter the breath"; B
LET Area = L*B
PRINT "The area is"; Area
END

CLS
REM
Input " enter the number"; N
let square = sqr(n)
Print "square is"; square
End

REM to find the profit of any item
INPUT "Enter the name of product"; N$
INPUT "Enter the cost of product"; CP
INPUT "Enter the selling price"; SP
LET PROFIT = SP-CP
PRINT "The profit is "; PROFIT
END

CLS
REM to convert Nepali currency to Indian currency
INPUT "Enter Nepali currency"; NC
LET IC = NC/1.6
PRINT "Indian currency is" IC
END

CLS
REM to check odd or even numbers.
INPUT "Enter the number"; num
IF num MOD 2 = 0 THEN
PRINT "The number is Even"
ELSE
PRINT "The number is Odd"
END IF
END





No comments:

Post a Comment