Qbasic Example Programs
Qbasic Example Programs
Search
Saturday, August 14, 2010
Q-BASIC PROGRAMS
2)Write a program to enter your name, city, country, age and print them.
CLS
Input
Input
Input
Input
Print
Print
Print
Print
End
"
"
"
"
"
"
"
"
End
13)Write a program to enter the initial mileage(m1) and final mileage (m2) then
calculate the distance traveled.
CLS
Input "Enter the Initial Mileage";M1
Input "Enter the Final Mileage";M2
Let D= M2-M1
Print " The distance covered=";D
End
"
"
"
=
"
15)Write a program to find out the simple Interest and the Amount.
Cls
Input " Enter the Principal";P
Input " Enter the Rate";R
Input " Enter the Time";T
Let I = P*T*R/100
Let A= P + I
Print " The simple Interest = ";I
Print " The amount=";A
End
Let P=2*(l+b)
Print" The perimeter of rectangle=" ;P
End
20)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
26)Write a program to enter the Nepalese currency and covert it to Indian Curren
cy.
CLS
Input Enter the Nepalese currency
Let I = N * 1.6
Print the Indian currency= ;I
End
;N
27)Write a program to enter the Indian currency and covert it to Nepalese Curren
cy.
CLS
Input Enter the Indian currency
Let N = I / 1.6
Print the Nepalese currency= ;I
End
;N
28)Write a program to enter any number and find out whether it is negative or po
sitive.
CLS
Input Enter the number ; N
If N>0 Then
Print
The number is positive
Else
Print The number is negative
EndIf
End
29)Write a program to enter any number and find out whether it is even or odd us
ing select case statement.
Cls
Input Enter any number ;N
R=N mod 2
Select case R
Case = 0
Print The number is Even number
Case Else
Print The number is odd number
End Select
End
Print It s a number 3
Case else
Print It s out of range ;
End select
End
Cls
Input Enter the alphabet ;A$
A$=UCase$ (A$)
Select Case A$
Case A
Print It s alphabet A
Case Else
Print It s not alphabet A
End Select
End
32)Write a program to enter any alphabet and find out whether the number is vowe
l or alphabet.
Cls
Input Enter Letters/Alphabet ;A$
A$ = UCase $ (A$)
Select case A$
Case A , E , I , O , U
Print Its a vowel
Case Else
Print
It s not a vowel
End Select
End
For I = 1 to 99 Step 2
Print I
Next I
End
39)Write a program to print numbers stated below USING WHILE WEND STATEMENT.
Cls
I = 1
While I<=100
Print I ;
I = I + 1
WEND
END
41)Write a program to print numbers stated below USING WHILE WEND STATEMENT.
1,3,5,7,9, 99
CLS
I = 1
While I <=99
Print I;
I = I + 2
WEND
END
42)Write a program to print numbers stated below USING WHILE WEND STATEMENT.
1,4,9, upto 10th term.
CLS
I=1
While I < =10
Print I^2;
I = I + 1
WEND
END
9:17 PM 1/17/2016