15 QBASIC Programs for Beginners
Introduction
In this article, you will be able to know, learn, and execute some simple programs based on characters, strings, and numbers.
QBASIC
programs
1. Write a program to display your name in QBASIC.
Print “Farhan”;
End
2. Write a program to print a number.
Print 10
End
3. Write a program to find the sum of two numbers.
Print 10
Print 20
Print 10+20
End
4. Write a program to print a number using a variable.
Let A=10
Print A
End
5. Write a program to find the sum of two numbers using variables.
Let A=10
Let B=20
Let c=A+B
Print c
End
6. Write a program to find the sum and average of three numbers using
variables.
Let A=10
Let B=20
Let C= 30
Let sum=A+B+C
Let Avg=sum/3
Print sum
Print Avg
End
7. Write a program to enter your name and print it.
INPUT “Enter your name:”; a$
Print “Name:”; a$
End
8. Write a program to display a number using input method.
INPUT “Enter a number:”; n
Print “Number:”; n
End
9. Write a program to enter your name and age and display them.
INPUT “Enter your name:”; a$
INPUT “Enter your age:”; n
Print “Name:”; a$
Print “Age:”; n
End
10. Write a program to enter two numbers and find their sum.
INPUT “Enter first number:”; a
INPUT “Enter second number:”; b
Let sum= a+b
Print “sum:”; sum
End
11. Write a program to find area of any rectangle.
INPUT “Enter length:”; l
INPUT “Enter breadth:”; b
Let area=l*b
Print “area:”; area
End
12. Write a program to find area of a rectangle using variables.
Let a=10
Let b=20
Let area= a*b
Print “Area:”; area
End
13. Write a program to find simple interest and amount.
INPUT “Enter principal:”; p
INPUT “Enter rate:”; r
INPUT “Enter time:”; t
Let si=p*r*t/100
Let amt= p+si
Print “Si:”; si
Print “Amt:”; amt
End
14. Write a program to find the area of any square.
INPUT “Enter side of a square:”; a
Let area= a*a
Print “Area of a square:”; area
End
15. Write a program to find the sum, difference, product, and quotient
using variables.
Let a=10
Let b=20
Let sum= a+b
Let diff= b-a
Let pro= a*b
Let div= b/a
Print “sum:”; sum
Print “diff:”; diff
Print “prod:”; pro
Print “quo:”; div
End
To know more visit https://zueducator.blogspot.com
No comments:
Post a Comment