Ask Question
17 September, 23:05

Write a Qbasic program to read the value of base and height of a triangle and find its area.

+2
Answers (1)
  1. 17 September, 23:12
    0
    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

    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
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a Qbasic program to read the value of base and height of a triangle and find its area. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers