Computer Studies
Draw a flowchart and write a program in QBASIC to display 10 different values of the expression (a + b)2. Take the values of a and b as inputs after each iteration.
Answer
Flowchart
QBASIC Program
Cls
For I = 1 To 10
Input "Enter two values"; A, B
S = (A + B) ^ 2
Print "(A+B)^2 = "; S
Next I
End
Output
Enter two values? 2,3
(A+B)^2 = 25
Enter two values? 4,2
(A+B)^2 = 36
Enter two values? 6,3
(A+B)^2 = 81
Enter two values? 5,8
(A+B)^2 = 169
Enter two values? 3,3
(A+B)^2 = 36
Enter two values? 4,4
(A+B)^2 = 64
Enter two values? 5,5
(A+B)^2 = 100
Enter two values? 6,1
(A+B)^2 = 49
Enter two values? 4,8
(A+B)^2 = 144
Enter two values? 3,9
(A+B)^2 = 144
Related Questions
Draw a flowchart and write a program in QBASIC to calculate the area and the perimeter of 10 different rectangles. Take the length and breadth as inputs and display the result.
A class teacher wants to calculate the average marks obtained by a student in three terms in a class of 50 students. Draw a flowchart and write a program in QBASIC to enter the name and the total marks obtained by a student in three terms. Display the result along with the name.
Draw a flowchart and write a program in QBASIC to enter the name and marks secured in 12 subjects in a term examination. Display the name, total and the average marks.
Draw a flowchart and write a program in QBASIC to display the sum of the first 10 terms of the series S = 1 + 2 + 4 + 8 + …….