Computer Science, asked by aarjavjan4575, 1 year ago

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 Anonymous
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 ganup362
2

re yaar me too is searching

Where to find??

Everyone are sending answers for C+, C++, Java, etc

Similar questions