Write QBASIC programs for the following questions:
(a) To calculate area of a rectangle. [ A = l × b ]
(b) To calculate perimeter of a rectangle. [ P = 2 ( l + b ) ]
Answers
Answered by
8
(a) To calculate area of a rectangle. [ A = l × b ]
Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
let A = l*b
Print" the area of rectangle=" ; A
End
(b) To calculate perimeter of a rectangle. [ P = 2 ( l + b ) ]
Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
Let P=2*(l+b)
Print" The perimeter of rectangle=" ;P
End
Anonymous:
hope its helps you sir
Answered by
21
Sample Q basic programs:
(i)
Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
A = l * b
Print" area of rectangle = " ;A
End
Output:
enter the length 10
enter the breadth 20
area of rectangle = 20
(ii)
Cls
Input "Enter length" ;l
Input "Enter breadth" ;b
P = 2(l + b)
Print " The perimeter of rectangle = " ;P
End
Output:
Enter length 10
Enter breadth 20
The perimeter of rectangle = 60.
Hope it helps!
Similar questions