Check for co-primes
|
Newbie Member
|
|
| 14Mar2006,10:20 | #1 |
|
Write a 'C' Program to Read two numbers and check whether they are Co-Primes or not
|
|
Team Leader
|
![]() |
| 14Mar2006,11:51 | #2 |
|
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.
|
|
Team Leader
|
![]() |
| 14Mar2006,15:56 | #3 |
|
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
|

