QBASIC
QBASIC
QBASIC
H. To input three different numbers and decide the smallest number amongst the three using
IF…THEN statement.
REM program to enter any three numbers and find the smallest number
CLS
INPUT "ENTER THE FIRST NUMBER"; A
INPUT "ENTER THE SECOND NUMBER";B
INPUT "ENTER THE THIRD NUMBER"; C
IF A<B AND A<C THEN
PRINT "FIRST NUMBER IS SMALLEST";A
ELSEIF B<A AND B<C THEN
PRINT "SECOND NUMBER IS SMALLEST";B
ELSEIF C<A AND C<B THEN
PRINT "THIRD NUMBER IS SMALLEST";C
ELSE
PRINT "ALL ARE EQUAL"
ENDIF
END
I . To input days of a week and decide "school day" or "holiday" using IF ….THEN statement.
REM PROGRAM TO ENTER ANY DAY FROM SUNDAY TO SATURDAY AND PRINT "SCHOOL
DAY" OR "HOLIDAY".
CLS
INPUT "ENTER ANY DAY";DAY$
IF DAY$="SUNDAY" THEN
PRINT "SCHOOL DAY"
ELSEIF DAY$="MONDAY" THEN
PRINT "SCHOOL DAY"
ELSEIF DAY$="TUESDAY" THEN
PRINT "SCHOOL DAY"
ELSEIF DAY$="WEDNESDAY" THEN
PRINT "SCHOOL DAY"
ELSEIF DAY$="THURSDAY" THEN
PRINT "SCHOOL DAY"
ELSEIF DAY$="FRIDAY" THEN
PRINT "SCHOOL DAY"
ELSEIF DAY$="SATURDAY" THEN
PRINT "HOLIDAY"
ELSE
PRINT "INVALID INPUT"
ENDIF
END
J. To decide whether an input number is divided by 5 and 3 or not?
CLS
INPUT "ENTER THE NUMBER";N
IF N/5=0 AND N/3=0 THEN
PRINT "DIVISIBLE"
ELSE
PRINT "NOT DIVISIBLE"
END IF
END
k. To input any number from 0 to 9 and check whether it is single digit number or not using
SELECT CASE statement.
CLS
INPUT"ENTER THE NUMBER";N
SELECT CASE N
CASE 0
PRINT "It is single"
CASE 1
PRINT "It is single"
CASE 2
PRINT "It is single"
CASE 3
PRINT "It is single"
CASE 4
PRINT "It is single"
CASE 5
PRINT "It is single"
CASE 6
PRINT "It is single"
CASE 7
PRINT "It is single"
CASE 8
PRINT "It is single"
CASE 9
PRINT "It is single"
CASE ELSE
PRINT "It is not single"
END SELECT
END
l. To input name of the SAARC country and print name of their capital city using SELECT
CASE statement.
CLS
INPUT "ENTER THE SAARC COUNTRY NAME";C$
SELECT CASE C$
CASE "NEPAL"
PRINT "KATHMANDU"
CASE "AFGANISTAN"
PRINT "KABUL"
CASE "INDIA"
PRINT "DELHI"
CASE "PAKISTAN"
PRINT ISLAMABAAD
CASE "BANGLADESH"
PRINT "DHAKA"
CASE "BHUTAN"
PRINT "THIMPU"
CASE "MALDIVES"
PRINT "MALE"
CASE "SRI LANKA"
PRINT "COLOMBO"
CASE ELSE
PRINT "ERROR"
END SELECT
END
20) Write a program to enter the Nepalese currency and covert it to Indian Currency.
CLS
Input “Enter the Nepalese currency” ;N
Let I = N * 1.6
Print “the Indian currency=”;I
End