Write a Pseudo Code to fins the LCM of two given numbers

Answer Posted / sudhir

int gcd(int a, int b)
{
if (a==0 && b==0) return -1;
if (b==0) return a;
return gcd(b,a%b);
}


int lcm (int a, int b)
{
return (int) (a*b)/gcd(a,b);
}

Is This Answer Correct ?    22 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Need guidewire related Documents(Interview Question/Tips/Best Practice/Dumps)

266


Please forward important interview and basic questions in VB6 on my email id: usneha_16@yahoo.co.in

1786


I'm new to ABAP. What is Module pool in SAP?

2302


Define distributed queries. can you explain me as soon as possible

1833


how to stop execution of step 3 in a job mainframe

1890


what is web service in java? have u use before.

1836


they asked me about srs (software requirement specifcation)? how can i get anydocumentation about srs & other documnts infomation like bdd, in testing? its urgent?

1663


can we allocate memory for interface? if no then why?

1636


When will you use shell script/Perl ahead of C/C++?

852


public static void main(String args[]) describe it

1785


what is the system development cycle

1501


1. Consider the following input and generate the object code using single pass assembler. JOHN START 0 USING *,15 L 1,FIVE A 1,FOUR ST 1,TEMP FOUR DC F’4’ FIVE DC F’5’ TEMP DS ‘F END

2572


how to convert infix expression to prefix expression?

3993


i want to improve my english vocab for racking campus written exam plz tell me best book for prepration......

1900


what is class module in vb6? what it's use? with example..

2150