![]() |
Check for co-primes
Write a 'C' Program to Read two numbers and check whether they are Co-Primes or not
|
Re: Check for co-primes
Simple. Just find the HCF between the 2 Nos and if its anything other than 1 or -1 then they are co-primes. Isnt finding HCF a simple logic.
|
Re: Check for co-primes
In mathematics, the integers a and b are said to be coprime or relatively prime if they have no common factor other than 1 and −1, or equivalently, if their greatest common divisor is 1.
In the program below, I've used the gcf() function to check whether the GCF of the two numbers is 1. Code: cpp
|
| All times are GMT +5.5. The time now is 05:48. |