Programming concept of Coprime Number using MATLAB

Coprime Number:

Write a program to enter two numbers & check whether they are co-prime or not.

[Two numbers are said to be co-prime , if their HCF is 1(one).]

Sample Input: 14,15
Sample Output:They are co-prime.

If you want to know more on co-prime number , check below link:

Click here


Please try by yourself first & then if you are unable to do , check below. In this way your programming skills will improve.



Algorithm:

Step 1:

Calculate the H.C.F. of two input numbers.


Reference Video(How to calculate G.C.D & L.C.M. of 2 numbers):


Step 2:

Check whether H.C.F. is equal to 1 or not using if else condition.

MATLAB CODE & explanation:




No comments