We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ff0f575 + 6147fee commit 5fb906aCopy full SHA for 5fb906a
algorithms/maths/highest_common_factor.m
@@ -1,16 +1,16 @@
1
-ffunction HCF = mini (x, y)
+function HCF = highest_common_factor (x, y)
2
%This function searches for highest common factor
3
%It first checks if any of the numbers equal to zero, if so the non zero number is the HCF
4
%If the numbers are different, you minus the bigger number by the smaller one and this is done by recursion.
5
if x==0
6
HCF = y;
7
elseif y==0
8
- HCF == x;
+ HCF = x;
9
elseif (y == x)
10
HCF = x;
11
elseif (y>x)
12
- HCF = mini(y-x,x);
+ HCF = highest_common_factor(y-x,x);
13
else
14
- HCF = mini(x-y,y);
+ HCF = highest_common_factor(x-y,y);
15
end
16
0 commit comments