Computer Science, asked by piyushsharma82paxg79, 1 year ago

Write a program to enter three values for i,j,k and check if they are pythagorian triplex or not. (in java)&(simply write for beginner).

Answers

Answered by anu32901
2

Answer:

  import java.util.Scanner;

 public class example{

   public static void main(String[] args){

   Scanner sc=new Scanner(System.in);

     int i =sc.nextInt();

    int j=sc.nextInt();

    int k=sc.nextInt();

    if ((Math.pow(i, 2) + Math.pow(j, 2) == Math.pow(k, 2))

                   || (Math.pow(j, 2) + Math.pow(k, 2) == Math.pow(i, 2))

                   || (Math.pow(i, 2) + Math.pow(k, 2) == Math.pow(j, 2))) {

                          System.out.println("Thegers are pythagorean triple");

     }

     else {

               System.out.println("Thegers are not pythagorean triple");

           }

}

}

Explanation:

Similar questions