AF
Home
Tag
Submit Notes
Ask Anything
Login
Subscribe Us
A
ny
F
orum
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 ?.
Follow @anyforumin
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 353
programming x 169
Posted On :
2018-01-12 16:44:47.0
Divesh
101
18
0
4
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
Divesh
101
18
0
Reply This Thread
0
Post Answer
Please Login First to Post Answer:
Login
Answer:
anyforum.in