AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: Java program to decide the size of the ladder

One evening when Suman came back to his home and saw the room is lock and he don´t have a key nor a instrument to break the lock. So he decided he will climb up from the other side´s balcony to enter the room. He decided to use ladder for that. Now help him in deciding the size of the ladder. Suman will give two numbers, First is the distance between his house and the ladder x and second in h, height of the house.

Sample Input:

3.00

4.00

Sample output:

5.0

corejava x 340
programming x 157
Posted On : 2018-01-12 16:44:47.0
profile Divesh - anyforum.in Divesh
9750
up-rate
4
down-rate

Answers


import java.util.Scanner;

class ladder
{
public static void main(String [] args){
Double a,b,c;
Scanner sc=new Scanner(System.in);
a=sc.nextDouble();
b=sc.nextDouble();
c =(a * a)+(b * b);

System.out.println(Math.sqrt(c));

}
}

Posted On : 2018-01-15 16:03:19
Satisfied : 0 Yes  0 No
profile Divesh - anyforum.in Divesh
9750
Reply This Thread
up-rate
0
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in