You are on page 1of 6

SAMPLE QBASIC PROGRAM

CLASS VI
2022-2023

Write a QBASIC Program which will print the area and perimeter of a Rectangle

'This QBASIC Program will print the area and perimeter of a Rectangle'
'Date : 25.12.2022, Author : Subhadeep Chakraborty'

Cls
Input "Please enter the length of the Rectangle = ", length
Input "Please enter the breadth of the Rectangle = ", breadth
Let perimeter = 2 * (length + breadth)
Let area = length * breadth
Print "Perimeter of the Rectangle is ="; perimeter
Print "Area of the Rectangle is ="; area

Write a QBASIC Program which will print the area and perimeter of a Square

'This QBASIC Program will print the area and perimeter of a Square'
'Date : 25.12.2022, Author : Subhadeep Chakraborty'

Cls
Input "Please enter the side of the Square = ", side
Let perimeter = 4 * side
Let area = side * side
Print "Perimeter of the Square is ="; perimeter
Print "Area of the Square is ="; area

Write a QBASIC Program which will take printed amount of a commodity from user and print the
discount amount and final amount when discount is 15%

'This QBASIC Program will take printed amount of a commodity from user and print the discount
amount and final amount when discount is 15%'
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the Printed Amount of the Commodity = ", printed_amount
Let discount = printed_amount * 15 / 100
Let final_amount = printed_amount - discount
Print "Printed Amount of the Commodity = "; printed_amount
Print "Discount is = "; discount
Print "Final Amount after discount is = "; final_amount
Write a QBASIC Program which will check a number divisible by 5 or not

'This QBASIC Program will check a number divisible by 5 or not'


'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the Number = ", number
Let r = number Mod 5
If r = 0 Then
Print "The number is divisible by 5"
Else
Print "The number is not divisible by 5"
End If
End

Write a QBASIC Program which will check a number Odd or Even

'This QBASIC Program will check a number Odd or Even'


'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the Number = ", number
Let r = number Mod 2
If r = 0 Then
Print "The number is EVEN"
Else
Print "The number is ODD"
End If
End

Write a QBASIC Program which will check a number Positive, Negative or Zero

'This QBASIC Program will check a number Positive, Negative or Zero'


'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the Number = ", number
If number > 0 Then
Print "The number is POSITIVE"
ElseIf number < 0 Then
Print "The number is NEGATIVE"
Else
Print "The number is 0"
End If
End
Write a QBASIC Program which will find out maximum number from two number
'This QBASIC Program will find out maximum number from two number'
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the 1st Number = ", number1
Input "Please enter the 2nd Number = ", number2
If number1 > number2 Then
Print "First number is greater than the Second Number"
ElseIf number2 > number1 Then
Print "Second number is greater than the First Number"
Else
Print "Both the numbers are equal"
End If
End

Write a QBASIC Program which will find out maximum number from three number
'This QBASIC Program will find out maximum number from three number. Please don't enter same
number twice or thrice'
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the 1st Number = ", number1
Input "Please enter the 2nd Number = ", number2
Input "Please enter the 2nd Number = ", number3
If number1 > number2 And number1 > number3 Then
Print "First number is the Maximum"
ElseIf number2 > number1 And number2 > number3 Then
Print "Second number is the Maximum"
ElseIf number3 > number1 And number3 > number2 Then
Print "Third number is the Maximum"
End If
End

Write a QBASIC Program which will take input of a Principal amount, rate of interest and time and
find out the Simple Interest
'This QBASIC Program will take input of a Principal amount, rate of interest and time and find out the
Simple Interest'
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Input "Please enter the Principal Amount = ", principal_amount
Input "Please enter the Rate of Interest = ", rate_of_interest
Input "Please ener the time (in Year) = ", time
Let simple_interest = (principal_amount * rate_of_interest * time) / 100
Print simple_interest
End
Write a QBASIC Program which will print 1 to 50
'This QBASIC Program will will print 1 to 50’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
For i = 1 To 50 Step 1
Print i
Next i
End

Write a QBASIC Program which will print 50 to 1 (in reverse order)


'This QBASIC Program will print 50 to 1 (in reverse order)’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
For i = 50 To 1 Step -1
Print i
Next i
End

Write a QBASIC Program which will print ODD numbers from 1 to 25


'This QBASIC Program will print ODD numbers from 1 to 25’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
For i = 1 To 25 Step 2
Print i
Next i
End

Write a QBASIC Program which will print EVEN numbers from 1 to 25


'This QBASIC Program will print EVEN numbers from 1 to 25’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
For i = 2 To 25 Step 2
Print i
Next i
End
Write a QBASIC Program which will print a Series like
7 14 21 28 35 42 49 56 63 70
'This QBASIC Program will will print a series like 7 14 21 28 35 42 49 56 63 70 ’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
For i = 7 To 70 Step 7
Print i
Next i
End

Write a QBASIC Program which will print a Series like


100 90 80 70 60 50 40 30 20 10
'This QBASIC Program will print a series like 100 90 80 70 60 50 40 30 20 10’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
For i = 100 To 10 Step -10
Print i
Next i
End

Write a QBASIC Program which will print First 25 natural numbers


Print the sum of them
'This QBASIC Program will print first 25 natural numbers and Print the sum of them’
'Date: 25.12.2022 Author: Subhadeep Chakraborty'

Cls
Let sum = 0
For i = 1 To 25 Step 1
Print i
sum = sum + i
Next i
Print "Sum of first 25 natural numbers is ="; sum
End

Write a QBASIC Program which will print First 25 natural numbers


Print the product of them
Cls
Let pro = 1
For i = 1 To 25 Step 1
Print i
pro = pro * i
Next i
Print "Product of first 25 natural numbers is ="; pro
End

You might also like