answersLogoWhite

0


Best Answer

1. sort desc, so a1 >= a2 >= a3

2. check if (a1*a1 == a2*a2 + a3*a3) then true

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a C algorithm to test whether the three numbers represent the sides of a right angle triangle?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write an algorithm to check whether a number is a prime number or not?

You can write out this algorithm. This will then be programmed into the device to make determining prime numbers easier.


How can you write an algorithm for getting autoformic numbers?

Perhaps you mean an automorphic number? Loop through a series of numbers - for example, all numbers from 1 to 10,000 - and check each of the numbers, whether the condition applies. The condition in this case is that if you square the number, the last digits represent the original number.


Devise an algorithm to test whether the three numbers represent the sides of a right angle triangle?

The two smallest sides must be larger than the longest side. So if two sides are 9, 11 then the other side could be 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18.


How do you find a right triangle when you have three numbers?

Three numbers may or may not define a right triangle. Also, the answer will depend on whether the three numbers are the lengths of sides or the measures of angles.


Is there an algorithm that yields only prime numbers?

What exactly do you mean "yields only prime numbers"? If you mean a formula that when given the numbers n=1, 2, 3, ... and so on generates the nth prime number (or a different prime number for each n) then no. If you mean an algorithm whereby a number can be tested to be a prime number then yes. (Using this prime_test algorithm, a simple algorithm can be written that would supply numbers one at a time to it and use its result to decide whether to yield the tested number or not, only yielding those numbers which pass the test.)


An algorithm to find whether a directed graph is connected or not?

You can use a The Depth-First Search algorithm.


Can these lengths make a triangle 5.0 4.8 9.1?

Check whether the largest of the numbers is greater than or equal to the sum of the other two. If it is, then you can't make a triangle; otherwise you can.


What is the algorithm of LCM of more than 3 numbers?

If you use methods based on prime factors, it is the same whether you have 2, 3, or more numbers: find all the factors that occur in any of your numbers. If you use a method based on Euclid's Algorithm (that is, lcm(a, b) = a x b / gcf(a, b), where you find the gcf with Euclid's Algorithm), then you can find the lcm for two numbers at a time. For example, to get the lcm of four numbers, find the lcm of the first two, then the lcm of the result and the third number, than the lcm of the result and the fourth number.


How do mathematicians determine whether or not really large numbers are prime?

A primality test is an algorithm for determining whether an input number is prime, but I'm willing to bet that a lot of mathematicians type "prime number calculator" into their web browsers.


Is 21 and 35 relatively prime?

You need to check whether they have a common factor. You can simply factor each of the numbers; for numbers that are much larger, using Euclid's algorithm is much faster.If the common factor of two numbers is greater than 1, then they are NOT relatively prime.


How many sides does a right triangle have?

Any triangle has three sides, whether it is a right triangle or not.


10 Why is twos complement usually used to represent integers?

The advantage of the two's complement method is that the procedure for adding or subtracting numbers is the same, whether the numbers are positive or negative. This makes the hardware for managing these numbers simpler.