Java Code for Pythagoras Theorem

This java programming code is used to find the pythagoras theorem. You can select the whole java code by clicking the select option and can use it. When you click text, the code will be changed to text format. This java program code will be opened in a new pop up window once you click pop-up from the right corner. You can just copy, paste this java code and use it to find the pythagoras theorem.

import java.util.*;
import java.lang.*;
class pythagoras_theorem
{  
    public static void main(String args[])
    {
   double Adjacent=2, Opposite=3, Hypotenuse=4;
//Hypotenuse
   double Hypotenuse1 = (Math.pow(Adjacent,2)) + (Math.pow(Opposite,2));
Hypotenuse1=Math.sqrt(Hypotenuse1);
System.out.println("Hypotenuse: "+Hypotenuse1);

//Adjacent
   double Adjacent1 = (Math.pow(Hypotenuse,2)) - (Math.pow(Opposite,2)) ;
Adjacent1=Math.sqrt(Adjacent1);
System.out.println("Adjacent: "+Adjacent1);

//Opposite
   double Opposite1 = (Math.pow(Hypotenuse,2)) - (Math.pow(Adjacent,2));
Opposite1=Math.sqrt(Opposite1);
System.out.println("Opposite: "+Opposite1);

    }
}
Other Programming Codes
Online Calculator : Pythagoras Theorem
Click on the select code link to copy and paste this free java program code for pythagoras theorem.

english Calculators and Converters

Ask a Question


Sitemap