Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program (3 versions: C, Python and PHP) that calculates the area of a triangle given its three sides. The formula or algorithm used

image text in transcribed

Write a program (3 versions: C, Python and PHP) that calculates the area of a triangle given its three sides. The formula or algorithm used is: Area = (s(s - a)(s - b)(s - c)) Where: s= perimeter-(a+b+c)/2 and a, b & c are the sides of triangle. You should implement 2 method besides your main code: 1. Perimeter method that need the value of the 3 sides (a,b,c) to find the value of s 2. Area method that need the value of the 3 sides (a,b,c) and Perimeter(s) Notes: 1. In C, you can import math header file to be able use square root method (sqrt) 2. How you can only show 2 digit after the decimal point without using any format method in Python and PHP? 3. In C you can show 2 digit after the decimal point as in 'printf in java, how? 4. How you can find the square root in Python and PHP without using any special method? 5. Make sure to select suitable data types. Sample Output: Enter the values of a, b and c 12 10 8 Area of a triangle = 39.68

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Factory Active Database For Enterprise Computing

Authors: Schur, Stephen

1st Edition

0471558443, 9780471558446

More Books

Students also viewed these Databases questions

Question

Question Can any type of stock or securities be used in an ESOP?

Answered: 1 week ago

Question

Question Can a self-employed person adopt a money purchase plan?

Answered: 1 week ago