Computer Science, asked by dishakedia, 8 months ago

Write an algorithm and draw flowchart to accept three numbers (h, p, b) and

check whether they are “Pythagorean Triplet” or not.
.
For instructions and guidelines look at the attached image

Attachments:

Answers

Answered by devanujroy89
0

Answer:

import java.util.Scanner;

public class Pythogoras

{

   public static void main(String []args)  

   {

    System.out.println("Write the base and height of the right angle trianlge");

    Scanner sc = new Scanner(System.in);

    int base =sc.nextInt();

    int height =sc.nextInt();

    double x= Math.pow(base,2)+Math.pow(height,2);

    System.out.println("write the hypotenuse");

    int hypotenuse =sc.nextInt();

    double y= Math.pow(hypotenuse,2);

    if (x==y)

    {

    System.out.println("They are pythogoras triplets");    

    }

    else

    System.out.println("ERROR");

   }            

}

Explanation:

Replace hypotenuse with the highest number

replace base and height with the ther two numbers

Similar questions