 # Help with Triangle

I need help with solving Triangle SAS [“Side, Angle, Side”]
It use cos

https://www.mathsisfun.com/algebra/trig-solving-sas-triangles.html

a2 = b2 + c2 − 2bc cosA

Example:

Angle A = 49°
Side b = 5
Side c = 7

a2 = 52 + 72 − 2 × 5 × 7 × cos(49°)
a2 = 25 + 49 − 70 × cos(49°)
a2 = 74 − 70 × 0,6560…
a2 = 74 − 45,924… = 28,075…
a = √28,075…
a = 5,298…
a = 5,30

So result

Side a is 5,3
Side b is 5
Side c is 7

So i need help with code to i can get this work
with
Side b is variable
Side c is variable
Angle A is variable Post your best effort. What does it do? How is that different from what you want?

We usually do not write code for people. We do want to help you to write your own code.

Read the forum guidelines to see how to post code and advice on how to ask a question.

Are you remembering to convert degrees to radians?

Clearly not. Cos(49)........

Clearly not. Cos(49)…

I don’t know how you figure “clearly” from pseudo code.

Read the text, a2 =..... COS(49) in 2 lines close to each other.

Read the text, a2 =… COS(49) in 2 lines close to each other.

Close together . . . in the PSEUDO CODE, i.e. code that clearly (warranted, this time) is not intended to be compiled

a2 = 74 − 70 × 0,6560...

Also remember that C/C++/Arduino (AFAIK) will want a "." rather than a "," to separate the parts of a floating point number. It'd be likely to do something particularly unreasonable if you don't.

Compiled or not..... If thinking is based on the wrong bases, the wrong theory, the result will be wrong.
OP migjht have been overlooking this, using radians when callin COS.