Вы находитесь на странице: 1из 6

Computers Laboratory / 1st Stage qbasic programs Thi-Qar University- EEE.

Dept / Evening Study

Ex1: Write a program to convert the weight from kilogram "K" to


pound "P"
*Hint 1 kg=2.2 lb

CLS
Input "Enter the weight in kilogram "; K
Let P=K*2.2
Print "The pound is "; P
End

Ex2: Write a program to convert the distance from miles "M" to


kilomiles" K".
Hint:1 mile =1.609 km
Cls
Input " Enter the length in miles";M
Let K=M*1.6
Print" The length in kilo miles=";K

End

Ex3: Write a program to find 10%,20% and 30% of the input


number.

Cls
Input" Enter any number" ;N
Let T=10/100*N
Let Twe=20/100*N
Let Thi=30/100*N
Print " 10%of input number=" ;T
Print " 20%of input number=" ;Twe
Print " 30%of input number=" ;Thi
End
Computers Laboratory / 1st Stage qbasic programs Thi-Qar University- EEE.Dept / Evening Study
Ex4: Write a program to enter any two numbers their Sum,Product
and the Difference.

CLS
Input " Enter any number" ;A
Input " Enter any number" ;B
Let Sum = A+B
Let Difference= A-B
Let Product = A*B
Print" the sum =" ;Sum
Print" the Difference =" ;Difference
Print" the Product =" ; Product
End

Ex5: Find the maximum and the minimum number between three
numbers.

CLS
INPUT "Please input the 1st number= ", a
INPUT "Please input the 2nd number= ", b
INPUT "Please input the 3rd number= ", c
Max=a
IF b > max THEN max= b
IF c > max THEN max= c
PRINT "The largest number is= "; max
Min= a
IF b < min THEN min = b
IF c < min THEN min = c
PRINT "The Smallest number is = "; min
END

EX6: program for determining the total & average for three
numbers:

CLS
Computers Laboratory / 1st Stage qbasic programs Thi-Qar University- EEE.Dept / Evening Study
REM This program will determine average for 3 numbers
INPUT "Please enter 1st number = ", a
INPUT "Please enter 2nd number = ", b
INPUT "Please enter 3rd number = ", c
t = a+b+c
s =T / 3
PRINT "The Total is = "; t
PRINT "The average is = ";s
END

Ex7: Write a program to input student's name, marks obtained in four


different subjects, find the total and average marks.

Cls
Input" Enter the name " ;N$
Input" Enter the marks in English" ;E
Input" Enter the marks in Maths" ;M
Input" Enter the marks in Science" ;S
Input" Enter the marks in Nepali" ;N
Let S=E+M+S+N
Let A=S/4
Print " The name of the student is" ;N$
Print " The total marks is" ;S
Print " The Average marks" ;A
End

Ex8: Write a program to find ( Req , Itotal , V1 , V2 , V3 , I1 , I2 , I3 )


Computers Laboratory / 1st Stage qbasic programs Thi-Qar University- EEE.Dept / Evening Study

EX9: program to find out a number is even or odd:


CLS
REM "Determine an integer is even or odd"
Computers Laboratory / 1st Stage qbasic programs Thi-Qar University- EEE.Dept / Evening Study
INPUT "Enter the number here= ", n
IF n MOD 2=0 THEN
PRINT "This number is Even"
ELSE
PRINT "This number is Odd"
END IF
END

Ex10: Write a program to enter any number and find out whether it
is negative or positive.
CLS
Input Enter the number; N
If N>0 Then
Print The number is positive
Else
Print The number is negative
End If
End

EX11: program to determine the grade point basis on Subject


mark:

CLS
REM "Determining the grade point basis on Subject mark"
INPUT "Enter the subject mark = ", n
IF n >= 95 THEN
PRINT "The grade point = A+"
END IF
IF n >=90 THEN

PRINT "The grade point = A -"


END IF
IF n >=85 THEN
PRINT "The grade point = B+"
END IF
IF n>= 80 THEN
PRINT "The grade point = B-"
Computers Laboratory / 1st Stage qbasic programs Thi-Qar University- EEE.Dept / Evening Study
END IF
IF n >=75 THEN
PRINT "The grade point = C+"
END IF
IF n >=70 THEN

PRINT "The grade point =C-"


END IF
IF n >= 65 THEN
PRINT "The grade point = D+"
END IF
IF n>= 60 THEN
PRINT " The grade point = D-"
END IF
IF N>= 55 THEN
PRINT " The grade point = E+"
END ID
IF N 50 THEN
PRINT " The grade point = E-"
END IF
IF N> 50 THEN
PRINT " The grade point = F"

END IF
END

Вам также может понравиться