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
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
Physics,
6 months ago
Business Studies,
6 months ago
Social Sciences,
6 months ago
English,
1 year ago