Write a program in QBASIC to accept three numbers and check whether they are Pythagorean triplets .The program must display the message accordinglaccordingly. h^2=p^2+b^2
Answers
Answered by
24
ANSWER
........
//program starts
import java.io.*;
class pyth
{
void main()throws IOException
{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
int a,b,c;
System.out.println("enter no.");
a=Integer.parseInt(obj.readLine());
System.out.println("enter no.");
b=Integer.parseInt(obj.readLine());
System.out.println("enter no.");
c=Integer.parseInt(obj.readLine());
if (a*a==b*b+c*c)
System.out.println("They are Pythogorean Triplet");
else if(b*b==a*a+c*c)
System.out.println("They are Pythogorean Triplet ");
else if(c*c==a*a+b*b)
System.out.println("They are Pythogorean Triplet a² + b² = c² ");
else
System.out.println("Test Failed !!! They are Non Pythogorean Triplet ");
}
}
//if u want to consider a² + b² = c² only then remove first 2 conditions
Answered by
2
re yaar me too is searching
Where to find??
Everyone are sending answers for C+, C++, Java, etc
Similar questions
Computer Science,
8 months ago
Biology,
8 months ago
Geography,
8 months ago
Social Sciences,
1 year ago
Math,
1 year ago
Geography,
1 year ago
Chemistry,
1 year ago