214k views
0 votes
Write a Qbasic program to read the value of base and height of a triangle and find its area. ​

User Bobestm
by
6.0k points

1 Answer

3 votes

Answer:

The program to this question as follows:

Program:

PRINT "Program: Area of Triangle" 'print message

INPUT "Enter base: ", base 'defining the variable base and input value from the user

INPUT "Enter height:",height 'defining variable height and input a value from user

Area=base*height/2 'formula to calculate Area

PRINT "Area of Triangle:", Area 'print Area

Output:

Program: Area of Triangle

Enter base: 2

Enter height: 3

Area of Triangle: 3

Step-by-step explanation:

In the above Qbasic program, first, a print function is used to print the message. In the next line, the input function is defined, which uses the "base and height" variable for user input.

Then another variable "Area" is defined that uses user input values to calculate the area of a triangle, and also store its calculated value. At the last, the print function is used to print Area variable value

User AndyInCambridge
by
6.3k points