USEFUL QBASIC PROGRAMMES (for class 9&10)


Qbasic programmes

Qbasic programmes:


1)Write a program to enter your name and print it .

CLS
Input 'Enter you name';n$
Print 'The name is';n$
End


2)Write a program to enter your name, city, country, age and print them.

CLS
Input " Enter the name ";N$
Input " Enter the city";C$
Input " Enter the country";CO$
Input " Enter the age";A
Print " The name is ";N$
Print " The city is ";C$
Print " The country is ";CO$
Print " The age is ";A
End


3)Write a program to find the area of rectangle.

Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
let A = l*b
Print" the area of rectangle=" ;a

End

4)Write a program to find the area of the triangle.

Cls
Input " enter the base" ;b
Input " enter the height" ;h
let T = 1/2*b*h
Print" The area of triangle=" ;T

End


5)Write a program to find the area of the circle.

Cls
Input" Enter the radius " ;R
Let C=22/7*R^2
Print " The area of circle =" ;C

E
nd


6)Write a program to find the circumference of the circle.
Cls
Input" Enter the radius " ;R
Let Circumference=22/7*R*2
Print " The area of circle =" ;Circumference
End


7)Write a program to find the area of the square.
Cls
Input" Enter the number" ;n
Let square= n^2
Print" The area of square=" ;Square
End


8)Write a program to find the area of the square and cube.
Cls
Input" Enter the number" ;n
Let square= n^2
Let Cube = n^3
Print" The area of square=" ;Square
Print" The area of cube=" ; Cube
End


9)Write a program to find the volume of the box.

Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
Input " enter the height " ;h
Let Volume= l*b*h
Print" The volume of box =" ;Volume
End


10)Write a program to convert the weight from kilogram to pounds.
Cls
Input"Enter the weight in kilogram";K
Let P=K*2.2
Print "The pound is ";P
End


11)Write a program to convert the distance from kilometer to miles.
Cls
Input"Enter the length in kilometer";K
Let M= K / 1.6
Print "The length in miles =";M
End


12)Write a program to convert the distance from miles to kilomiles.
Cls
Input " Enter the length in miles";M
Let K=M*1.6
Print" The length in kilo miles=";K
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


14)Write a program to find out the simple Interest.
Cls
Input " Enter the Principal";P
Input " Enter the Rate";R
Input " Enter the Time";T
Let I = P*T*R/100
Print " The simple Interest = ";I
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


16)Write any number and find it's half.

Cls
Input "Enter the desired number "; N
Let H = N/2
Print "The half of the number = ";H
END


17)Write a program to find the area of four walls of a room.
Cls
Input"Enter the height ";H
Input"Enter the length "; L
Input"Enter the Breadth";B
Let A= 2 * H * (L+B)
Print " The area of four walls =";A
End


18)Write a program to find the perimeter of a rectangle.
Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
Let P=2*(l+b)
Print" The perimeter of rectangle=" ;P
End


19)Write a program to enter any three numbers,sum and the average.
Cls
Input " Enter any number" ;A
Input " Enter any number" ;B
Input " Enter any number" ;C
Let Sum = A+B+C
Let Average =Sum/3
Print" The sum=" ;Sum
Print" The Average is " ;Average
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


21)Write a program to find the average of three different numbers.
Cls
Input" Enter the number " ;A
Input" Enter the number " ;B
Input" Enter the number " ;C
Let Avg= (A+B+C)/3
Print" The average=" ;Avg
End


22)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


23)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


24)Write a program to convert the distance to kilometer to miles.
Cls
Input" Enter the kilometer" ;K
Let M=K/1.6
Print " The miles = " ;M
End


25)Write a program to find the perimeter of square.
Cls
Input “Enter the length”; L
Let P =4 * L
Print “ The perimeter of square=”;P
End

26)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


27)Write a program to enter the Indian currency and covert it to Nepalese Currency.
Cls
Input “Enter the Indian currency” ;N
Let N = I / 1.6
Print “the Nepalese currency=”;I
End


28)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”
EndIf
End


29)Write a program to enter any number and find out whether it is even or odd using 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


30)Write a program to check the numbers between 1 & 3.
Cls
Input “Enter the numbers between 1-3”;N
Select case N
Case 1
Print “It’s number 1”;
Case 2
Print “It’s a number 2”;
Case 3
Print “It’s a number 3”
Case else
Print “It’s out of range”;
End select
End


31)Write a program to enter any alphabet and test alphabet is ‘a’ or not using the select case statement.
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 vowel 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


33)Generate the following numbers using For….Next…..Loop.
1,2,3,4,…,50
Cls
For I = 1 to 50 Step 1
Print I
Next I
End


34)Generate the following numbers using For….Next…..Loop.
1,3,5,7,9,....99
Cls
For I = 1 to 99 Step 2
Print I
Next I
End


35)Generate the following numbers using For….Next…..Loop.
2,4,6,8,10,…50

Cls
For I = 2 to 50 Step 2
Print I
Next I
End


36)Generate the following numbers using For….Next…..Loop.
1,3,5,7,…99
Cls
For I = 1 to 99 Step 2
Print I
Next I
End


37)Generate the following numbers using For….Next…..Loop.
5,10,15,…90

Cls
For I = 5 to 90 Step 5
Print I
Next I
End


38) Generate the following numbers using For….Next…..Loop.
10,20,30,40,…100.
Cls
For I = 10 to 100 Step 10
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


40)Generate the following numbers using For….Next…..Loop.
2,4,6,8,10….50
Cls
I = 2
While I < =50
Print I;
I = I + 2
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



1.Write a program to find the factorial of given numbers.

Cls
Input"Enter your number:";n
Fact = 1 
For x = 1 to n
Fact = fact × n
Next x
Print"Factorial number:";n
End 


2.NEPAL
   NEPA
   NEP
   NE
   N

Cls
A$="NEPAL"
FOR i=len(A$) to 1 step -1
print left$(A$,I)
next
End


3.Write a program to find the area of the circle.


Cls
Input" Enter the radius " ;R
Let C=22/7*R^2
Print " The area of circle =" ;C
End


4.Write a program to find the circumference of the circle.

Cls
Input" Enter the radius " ;R
Let Circumference=22/7*R*2
Print " The area of circle =" ;Circumference
End


5.Write a program to find the area of the square.


Cls
Input" Enter the number" ;n
Let square= n^2
Print" The area of square=" ;Square
End


6.Write a program to convert the distance from kilometer to miles.


Cls
Input"Enter the length in kilometer:";K
Let M= K / 1.6
Print "The length in miles =";M
End


7.Write a program to convert the distance from miles to kilomiles.


Cls
Input " Enter the length in miles:";M
Let K=M*1.6
Print" The length in kilo miles=";K
End


8.Write a program to find out the simple Interest.


Cls
Input " Enter the Principal";P
Input " Enter the Rate";R
Input " Enter the Time";T
Let I = P*T*R/100
Print " The simple Interest = ";I
End


9.Write a program to find the area of four walls of a room.


Cls
Input"Enter the height ";H
Input"Enter the length "; L
Input"Enter the Breadth";B
Let A= 2 * H * (L B)
Print " The area of four walls =";A
End


10.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


11.Write a program to enter the Indian currency and covert it to Nepalese Currency.


Cls
Input “Enter the Indian currency” ;N
Let N = I / 1.6
Print “the Nepalese currency=”;I
End


12.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”
EndIf
End


13.Write a program to enter any number and find out whether it is even or odd using 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


14.Write a program to enter any alphabet and find out whether the number is vowel or consonent.


Cls
Input “Enter any letter:";x
If x="a" or x="e" or x="I" or x="o" or x="u" Then print "vowel"
Else
Print"consonent"
End if
End


15. Generate the following numbers using For….Next…..Loop.

10,20,30,40,…100.

Cls
For I = 10 to 100 Step 10
Print I
Next I
End


16.Generate the following numbers using For….Next…..Loop.

2,4,6,8,10….50

Cls
I = 2
While I < =50
Print I;
I = I 2
WEND
End


17.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


18.Generate the following numbers using For….Next…..Loop.

1,2,3,4,…,50

Cls
For I = 1 to 50 Step 1
Print I
Next I
End


19.Write a program to enter any number and find out whether it is even or odd using 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


20.Input any number from the side of user and find out factors of a given number

Cls
Input"Enter anynumber:";n
Print"Factors of a number:";n
For n = 1 to n
R = n mod p
If r = 0 then print p;
Factor = Factor 1
Next x
Print"Numbers of Factor:";Factor
End


21.Write a programme to find out composite or prime.


Cls
Input"Enter a number :";a
If a = 1 or a = 2
Print"No prime , no composite"
Else
For x = 2 to a/2
R = a mod b
If r = 0 then c = c 1
End if
Next b
If c = 0 then
Print a ; "prime"
Else
Print a;"not prime"
End if
End


22.Write a program to find out Reverse order of a given number.

Cls
Input"Enter any no :";a
While a <> 0
R = a mod 10
S = s × 10 r
A = a/10
Wend
Print"Reverse number:";s
End

23.wrie a program to  find out the given number is palindrome or not.

Cls
A = n
While n <> 0
R = n mod 10
S =s × 10 r
N = n /10
Wend
If a =s then
Print a "palindrome"
Else
Print a "not palindrome"
End if
End


24.write a program to display all prime numbers.

Cls
Print 1,2
For x = 3 to 100
For y = 2 to x-1
R = x mod y
If r = 0 then go to below
Next y
Print x
Below:
Next x
End


25.Write a program to find out it is Armstrong or Not.


Cls
Input"Enter your number:";a
X = a
While a <> 0
R = a mod 10
S = s × 10 r
A = a / 10
Wend
If r = s then
Print x; "Armstrong"
Else
Print x;"Not armstrong"
End if
End


Comments

  1. Nice prabesh brw you can got it in your short level
    You are lucky brw better luck for u

    ReplyDelete

Post a Comment

Please do not enter any spam link in the comment box

Most Popular Posts

Top 5 Best Gfx Tool PUBG (Android/iPhone) 2020 - GAMING HUB

Get Free PUBG UC & PUBG Royale Pass From This app

BEST HEADPHONES FOR PLAYING PUBG!!