1) Write an Algorithm and draw a Flowchart to calculate the area of a square if the length is 5cm(Hints area= ll). 2) Write an Algorithm and draw a Flowchart to calculate the sum between 4,5 and 6. 3) Write an Algorithm and draw a Flowchart to calculate the area of a rectangle if the length and breadth of reactangle are 9cm and 20 cm(hints area=lb). Do your assignment in Google docs or MS Word download it as a pdf file,
Answers
Step-by-step explanation:
Following three algorithms can be used to calculate the area of a triangle:
Algorithm 1:
Input1 = length of base
Input2 = height
Output (Area) = 0.5 * Input1 * Input2
Algorithm 2: Heron's Formula
Input 1 = side1
Input 2 = side2
Input 3 = side3
Calculate semiperimeter s = (Input1 + Input2 + Input 3) / 2
Output (Area) = sqrt {s * (s - Input1) * (s - Input2) * (s - Input3)}
Algorithm 3: Co-ordinate Geometry
Accept the co- ordinates of the three vertices of the triangle as 6 inputs x1, y1, x2, y2, x3, ye
Apply distance formula to calculate the length of the three sides as:
side1 = sqrt { (x2 - x1) ^ 2 + (y2 - y1) ^ 2}
side2 = sqrt { (x3 - x2) ^ 2 + (y3 - y2) ^ 2}
side3 = sqrt { (x1 - x3) ^ 2 + (y1 - y3) ^ 2}
Once, we have got the lengths of the three sides, apply Algorithm 2.