**New course!**Every coder should learn

**Generative AI!**

+ 1

# Triangle in java

Hello guys, I tried to solve this question Input the length of three sides of a triangle, calculate the area of the triangle, and output the results. It is suggested that if the three sides of triangle are a, b and c respectively, the formula for calculating the triangle area is as follows: S=(a+b+c)/2 Area = sqr s* (s-a)(s-b)(s-c) I wrote the code but im facing some problems with the BufferReader i dont know if i have to do a class and what to fill in the class, and IOExpetion facing the same issue, so please if you can help I’ll appreciate This is the code https://code.sololearn.com/c6RWX5Aa8uD9/?ref=app

5 Answers

+ 4

You line 34 has got a typo(formula mistake)
replace it with -
return(Math.sqrt(s*(s-a) * (s-b) * (s-c)));
And the rest looks find. congrats.

+ 2

Your BufferedReader is missing the letter 'd'
(line 43)
HeeSoKa
Spelling wrong line 58 of "IOException" and add this-
import java.io.IOException;

+ 2

These are all needed to be imported. You don't need anything else.
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
There are lots of typo like IOException, BufferedReader, readLine()....
*Typo formula of area. You wrote (c-a) where it should be (s-a).*
Basically, your program has lots of incorrect spelling or typo. Not much of a problem.

+ 1

thanks, so now the code is okay i dont have to change anything else right ?

0

(S-k)