Hii everyone!! Here is my code which is nt working..plzz give suggestion or remove d error from d program n fix it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hii everyone!! Here is my code which is nt working..plzz give suggestion or remove d error from d program n fix it

This is my code Someone help me plzzzzz https://code.sololearn.com/cNehm5ttt8cq/?ref=app In this code, i want to input any two side which i dont know whether it is height,breadh or hypotenius as like dis it is just an example Enter the height 36 Enter the breadth 46 hyp = ? Using only buffered reader and ternary operaror here i can also take breadth or hyp in place of height I know u can solve my prblm so plzzzzz Arun Tomar Mohammad Nabavi Fata1 Err0r Elmer Martens Gaurav Agrawal @

25th May 2018, 3:36 PM
Harsh Agrawal
Harsh Agrawal - avatar
9 Answers
+ 7
Harsh Agrawal I would help you, but Java is my worst language. I'm sorry.
26th May 2018, 7:14 AM
Robyn A
Robyn A - avatar
+ 4
Harsh Agrawal Maybe I don't really get what you want so I just fix the errors from your code... import java.io.*; class abc { public static void main(String args[]) throws IOException { BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter the height"); double a= Double.parseDouble(br.readLine()); System.out.println("enter the breadth"); double b= Double.parseDouble(br.readLine()); System.out.println("enter the hyptotenius"); double c= Double.parseDouble(br.readLine()); a= (a+b)>c?a:c; b= (b+c)>a?b:a; c= c<(a+b)?c:a; double hei= Math.sqrt(Math.pow(c,2)-Math.pow(b,2)); double bre= Math.sqrt(Math.pow(c,2)-Math.pow(a,2)); double hyp= Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); System.out.println(hei); System.out.println(bre); System.out.println(hyp); } }
26th May 2018, 2:37 PM
Elmer Martens
Elmer Martens - avatar
+ 3
https://code.sololearn.com/c3I0D0b26Fre/?ref=app Harsh Agrawal i do it but with the help of scanner class.. you did so many mistakes like taking same variables so many time.. or you declaration one variables so many time.. i.e i did not change your program.. so you learn from your mistakes
25th May 2018, 6:17 PM
Arun Tomar
Arun Tomar - avatar
26th May 2018, 5:33 AM
Elmer Martens
Elmer Martens - avatar
+ 3
thnxxx Elmer Martens but this is not what i want but i m happy that u try n give some suggestion about dis code
26th May 2018, 3:47 PM
Harsh Agrawal
Harsh Agrawal - avatar
+ 2
Harsh Agrawal According to your program.. and your word.. you need find out the third side of right angle triangle. you only take two input from the user.. now user have a choice.. which side he or she want to find out wheathe it can be height or breath or hypontinus i not say it can not be done.. but using only ternary operator make it complex.... Elmer Martens hope you now understand the questions.. let me know
26th May 2018, 3:53 PM
Arun Tomar
Arun Tomar - avatar
+ 1
Arun Tomar I just want to use ternary operator so plzzz make it with ternary operator only plzzzz yrrrrrrr Dont make it with any other as like switch case,if,if else etc
26th May 2018, 3:29 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
Elmer Martens this is nt a program what i want? plzzzz read my question carefully den make it plzzzzz
26th May 2018, 6:09 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
but Arun Tomar i just want to make it wid ternary operator dats why this program became complex n tough but when der is nothing hard to do it does nt make excitment to do dat work hope u get it so if u hve any trick to do dis den plzzz solve it for me.... thnxxxxx n thnxxxx in advance
26th May 2018, 3:57 PM
Harsh Agrawal
Harsh Agrawal - avatar