## arupa -4

write a program to calculate the Highest Common Factor of three input numbers

## selvaganapathy 31

I give algorithm you try it in C#

HCF (GCD) Algorithm

GCD ( M, N ) {
If N > M then return GCD ( N, M )
else If N = 0 then return M
else return GCD ( N, MOD ( M, N) )
}

It is simple to covert it to C#
Also it is for two input

For three input

GCD ( M, N, O ){
return GCD ( M, GCD ( N, O ) )
}

## puneetkay 40

I give algorithm you try it in C#

HCF (GCD) Algorithm

GCD ( M, N ) {
If N > M then return GCD ( N, M )
else If N = 0 then return M
else return GCD ( N, MOD ( M, N) )
}

It is simple to covert it to C#
Also it is for two input

For three input

GCD ( M, N, O ){
return GCD ( M, GCD ( N, O ) )
}

Hie,

Thanks buddy, but i didnt really get the algo.
Heres the one from me:
=======
1 Input: num type variables M,N, HCF. (eg: M=100, N=125)
2 Find the smaller one from M,n. (eg: smaller: M)
3 Start a loop from M to M/2. (eg: i=m;i<=m/2;i++)
___1 Check whether i%m=0 & i%n==0.
___2 HCF = i; break;