Skip to main content

QBASICprogramming

1. Enter any two number and display its sum.
   
   CLS
   INPUT"Enter first number";A
   INPUT"Enter second number";B
   S = A + B
   PRINT"Sum of two numbers=";S
   END

 2. Enter any three numbers  and display its product.
    
   CLS
   INPUT"Enter first number";A
  INPUT"Enter second number";B 
  INPUT"Enter third number";C
  P=A * B * C
  PRINT"Product of three number=";P
  END

3.Enter any five numbers and display its average.

 CLS
INPUT"Enter first number";A
INPUT"Enter second number";B
INPUT"Enter third number";C
INPUT"Enter fourth number";D
INPUT"Enter fifth number";E
AVG=(A+B+C+D+E)/5
PRINT"Average of five numbers=";AVG
END


4. Enter any two numbers and display its sum,difference,product and average.

CLS
INPUT"Enter first number";A
INPUT"Enter second number";B
S=A+B
D=A-B
P=A*B
AVG=(A+B)/2
PRINT"Sum of two numbers=";S
PRINT"Difference of two numbers=";D
PRINT"Product of two numbers=";P
PRINT"Average of two numbers=";AVG
END

5.Enter any three numbers and display its sum,product and average.

CLS
INPUT"Enter first number";A
INPUT"Enter second number";B
INPUT"Enter third number";C
S=A+B+C
P=A*B*C
AVG=(A+B+C)/3
PRINT"Sum of three numbers=";S
PRINT"Product of three numbers=";P
PRINT"Average of three numbers=";AVG
END


6. Display square of an input number.

CLS
INPUT"Enter any number";A
S=A^2
PRINT"Square of the given number is=";S
END


7. Display cube  of an input number.

CLS
INPUT"Enter any number";A
C=A^3
PRINT"Cube of the given number=";C
END


8.Display square root of an input number.


CLS
INPUT"Enter any number";
S=A^(1/2)
PRINT"Square root of the given number is=";S
END


9.Display cube root of an input number.

CLS
INPUT"Enter any number";A
C=A^(1/3)
PRINT"Cube root of the given number is=";C
END


10.Input two different numbers and find the remainder dividing the first number by the second number.


CLS 
INPUT"Enter first number";A
INPUT"Enter second number";B
R=A MOD B
PRINT"The remainder is=";R
END


11. Display area of rectangle.

CLS
INPUT "Enter  length";L
INPUT "Enter breadth";B
A=L*B
PRINT "Area of rectangle=";A
END

12.Display area of square.

CLS
INPUT "Enter length";L
A=L^2
Print "Area of square=";A
END

13. Display area of circle.
CLS
INPUT "Enter radius";R
A=22/7*R^2
PRINT "Area of circle=";A
END

14. Display perimeter of rectangle.

CLS 
INPUT"ENTER LENGTH"; L
INPUT"ENTER BREADTH"; B
P=2*(L+B)
PRINT"PERIMETER OF RECTANGLE ";P
END

15. Display perimeter of square.

CLS
INPUT "ENTER LENGTH"; L
P=4*L
PRINT"Perimeter of square=";P
END

16. Display circumference of  circle.

CLS 
INPUT"ENTER RADIUS";
C=2*22/7*R
PRINT"Circumference of circle=";C
END

17 Display area and perimeter of  rectangle.

CLS
INPUT "Enter  length";L
INPUT "Enter breadth";B
A=L*B
P=2*(L+B)
PRINT "Area of rectangle=";A
PRINT"Perimeter of rectangle="P
END

18. Display area and perimeter of square.

CLS
INPUT "Enter length";L
A=L^2
P=4*L
PRINT "Area of square="A
PRINT"Perimeter of square=";P
END

19.Display area and circumference of  circle.
CLS
INPUT "Enter radius";R
A=22/7*R^2
C=2*22/7*R
PRINT "Area of circle=";A
PRINT"Circumference of circle=";C

END




Comments

Popular posts from this blog

17 QBASIC Programming

1. Create a sequential file "std.dat" to store name and marks obtained in English, Math and Science subjects for a few students. (74 set 1) OPEN   “std.dat”   FOR OUTPUT   AS   #1 DO CLS INPUT “Enter name “; N$ INPUT   “Enter English marks”; E INPUT “Enter Math's marks"; M INPUT "Enter Science marks"; S WRITE #1, N$, E, M, S INPUT "Do you want to continue (Y/N)";CH$ LOOP WHILE UCASE$ (CH$) "Y" CLOSE #1 END 4.   WAP to add some more   records in a data file “ABC.DAT” having following fields : patient’s name, address and age.  OPEN   “ABC.DAT”   FOR OUTPUT   AS   #1 DO CLS INPUT “Enter Patients name “; N$ INPUT   “Enter patients address”; A$ INPUT “Enter Patient's age "; A WRITE #1, N$, A$, A INPUT "Do you want to continue (Y/N)";CH$ LOOP WHILE CH$="Y" OR CH$="y" CLOSE #1 END       6.WAP to store records regarding the information of book’s number, name and author’s ...

QBASIC Solutions

Q.1) WAP to change degree Celsius into degree Fahrenheit.   => CLS        INPUT "Enter degree celsius value" ; D        F = ( 9 * C / 5 ) + 32        PRINT "Degree Fahrenheit value = "; F        END Q.2) WAP to change dollar into Nepali currency.   => CLS       INPUT "Enter Dollar value"; USD        NRS = USD * 100       PRINT "Nepali currency value = "; NRS       END Q.3) WAP to change Indian currency into Nepali currency. => CLS                   INPUT "Enter Indian currency value"; IC       NRS = IC * 1.6        PRINT "Nepali currency value = "; NRS   ...
MOTHER'S DAY Mother's Day  is a celebration honoring the mother  of the family, as well as motherhood, maternal bonds, and the influence of mothers in society. It is celebrated on various days in many parts of the world, most commonly in the months of March  or May .  MOTHER'S DAY is complements similar celebrations honoring family members, such as Father's day  and Siblings day . Mother's day is the most special day for a mom. This is the day the children's show there love to there mom. The mom always waits for this day.  In Nepal it is known as amma ko mukh herne din.  My mother is the most important person in my life. She always cares about me. She is the most caring and loving mom in the world. my mother's name is Sunita Dangol. She is thirty-eight years old. She gave birth to me. She taught me to walk. She sent me school so that, I can do better. It's always have been my dream to make my mother  be proud for my go...