Re: hcf and lcm Programming Software Development by hk<3ob1993 [QUOTE=mitrmkar;592469]Umm, I think I got the hcf part of it (thanks hammerhead), but how to figure out 'lcm of 2 nos' just beats me :-/ ...[/QUOTE] lcm is the easy part theres a property in maths: for to number x and y hcf(x,y) * lcm(x,y) = x*y just divide the product of the 2 numbers by the hcf ... u have ur lcm Re: hcf and lcm Programming Software Development by mitrmkar [QUOTE=hammerhead;592457]Okay here is the pseudo code for hcf, credit to Euclid.[/QUOTE] Umm, I think I got the hcf part of it (thanks hammerhead), but how to figure out 'lcm of 2 nos' just beats me :-/ ... hcf and lcm Programming Software Development by sailee Pls help me in finding hcf and lcm of 2 nos Re: hcf and lcm Programming Software Development by Ancient Dragon [QUOTE=sailee;592273]Pls help me in finding hcf and lcm of 2 nos[/QUOTE] What the hell does that mean :angry: Re: hcf and lcm Programming Software Development by Narue >Pls help me in finding hcf and lcm of 2 nos It's easy. All you do is grab the igm, do a qp on the xt half of the pgid and roll everything up into a qt7-qualified czsm. Hope that helps! :) Re: hcf and lcm Programming Software Development by Salem > Pls help me in finding hcf and lcm of 2 nos Have you tried looking down the back of the sofa? That's where I usually find things. Re: hcf and lcm Programming Software Development by hammerhead Okay here is the pseudo code for hcf, credit to Euclid. [CODE] gcd(m,n) r<-(m MOD n); if r=0 then { return n } else { m<-n n<-r gcd(m,n) } [/CODE] Sorry if my pseudocode is not as per standard. Re: hcf and lcm Programming Software Development by hammerhead [QUOTE=mitrmkar;592469]Umm, I think I got the hcf part of it (thanks hammerhead), but how to figure out 'lcm of 2 nos' just beats me :-/ ...[/QUOTE] Also note how m and n get interchanged if n>m, consider the case of m=6 and n=15 r1=6 MOD 15 = 6 m<-n implies m=15 n<-r implies n=6 the process is repeated to get gcd as 3 HCF Code Programming Software Development by preetigupta.pd hi plz give me the exact code of finding hcf and lcm of 5,10 two no. in c sharp plz reply me as soon as possible Re: HCF Programming Software Development by puneetkay …;643765]I give algorithm you try it in C# [B]HCF (GCD) Algorithm[/B] GCD ( M, N ) { If N > M… me: [B]=======[/B] 1 Input: num type variables M,N, HCF. (eg: M=100, N=125) 2 Find the smaller one… Check whether i%m=0 & i%n==0. ___2 HCF = i; break; Hope this can help you! :) Regards, PuneetKay Re: HCF Programming Software Development by selvaganapathy I give algorithm you try it in C# [B]HCF (GCD) Algorithm[/B] 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 ) ) } Program for finding HCF Programming Software Development by Jack_1 …, i have written a code for finding HCF but it does not work. please help…; if d==o cout<<"The hcf is:"<<b<<endl; …; if f==0 cout<<"The hcf is:"<<d,,endl; if f&…; if h==0 cout<<"The hcf is:"<<f<<endl; …>>0 cout<<"The Hcf could not be found out due to the some… Re: Program for finding HCF Programming Software Development by Lerner … but gives you wrong output? 3) Avoid use of abbreviations. HCF and gcd are probably synonyms, but it would be better… Re: LCM & HCF of 2 nos Programming Software Development by s_sridhar Consider 2 numbers a and b and a > b. [code] function hcf { if (a%b)==0 return b else hcf(b,a%b) } lcm = (product of 2 numbers)/hcf [/code] LCM & HCF of 2 nos Programming Software Development by BimanD Find the HCF and LCM of 2 nos using C Programming? Re: hcf and lcm Programming Software Development by hammerhead LCM is the tricky one. One needs to know that every number greater than 1 can be represented as products of prime numbers. Once factors each number m,n into its corresponding prime factors and then by multiplying the numbers with highest order we get the LCM. I have never implemented it on C++, it would be a good idea to do it now :D Here are … Re: hcf and lcm Programming Software Development by mitrmkar [QUOTE=hammerhead;592484]the process is repeated to get gcd as 3[/QUOTE] Ermm, so eventually everything rolls up into a "qt7-qualified czsm" (?) Re: hcf and lcm Programming Software Development by bugmenot note that with any two numbers a and b, a * b = gcd(a, b) * lcm(a, b) Re: hcf and lcm Programming Software Development by sailee pls could you do it by void main.... i m only a kid.... Re: hcf and lcm Programming Software Development by sailee [QUOTE=mitrmkar;592587]Ermm, so eventually everything rolls up into a "qt7-qualified czsm" (?)[/QUOTE] I m just a 14 yr old kid who has been taught d basics....:icon_redface: so pls help me do it in void main or my prof wil hang me upside-down....:sad: Re: hcf and lcm Programming Software Development by Prabakar I dont like to use recursion, unless it is very much necessary. If i were to calcualte GCD between 2 numbers, I would do it somthing like this. [CODE]#define min(a, b) (a)<(b)?(a):(b) int main ( ) { int a, b, i, c, d, gcd = 1, lcm ; cin >> a >> b ; c = a ; d = b ; for ( i = min(a, b) ; i > 1 ; i-- )… Re: hcf and lcm Programming Software Development by Radical Edward > I dont like to use recursion, unless it is very much necessary Don't fear recursion, it's cool! ;) Actually, Ed doesn't use recursion either unless it makes the code much shorter or simpler. It's a great tool if you know when to use it and more importantly, when not to use it. Re: hcf and lcm Programming Software Development by jephthah this thread made me laugh. HCF Programming Software Development by arupa write a program to calculate the Highest Common Factor of three input numbers Re: LCM & HCF of 2 nos Programming Software Development by jephthah yes. yes you can. Re: LCM & HCF of 2 nos Programming Software Development by MosaicFuneral What is a "nos"? Re: LCM & HCF of 2 nos Programming Software Development by jephthah either a sloppy abbreviation for "numbers" (abbr. "no.") or he's looking for the LCM and GCF of two noses. on further review, i prefer the latter. Re: LCM & HCF of 2 nos Programming Software Development by Nick Evan You should really watch the Fast and the Furious, then you would have known: [URL="http://www.holley.com/index.asp?division=NOS"]Nitrous Oxide Systems[/URL] Highest Common Factor in Haskell Programming by nadiam …'m practicing with simple online questions and there's a hcf question which I found the answer to online(http://snipplr… but yeah. Could someone please explain to me? hcf a 0 = a hcf a b = hcf b y where y = mod a b… need help with assembler program Programming Software Development by n_borad …s algorithm on them (3) prints the result – the HCF of the two Notes: Your program MUST be copiously commented… I.D. - 0569729 Using Euclids algorithm to find the HCF', 0Ah, 0Dh, 'of two positive integers between 1 and… 'Please type the second integer $' prompt4 db 0Ah, 0Dh, 'The HCF is $' goodbye db 0AH, 0Dh, 'quitting now$' .code ;first,…