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

WS-NUM PIC S9(05)V(02) SIGN TRAILING SEPARATE MOVE '0050000+' TO WS-NUM The value stored is 00500,00+ MOVE '0050000-' TO WS-NUM Then what is the value will be stored in WS-NUM? Am getting '-00500,00'.....>>> What should I declare to WS-NUM so that I can get correct values for both + & - signs.

1851


what is the difference between SCAN AND CHECK,LOKUP AND XFOOT? where we can use thease opcodes? Can any body tell me real time senariao with example?

2096


Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)

761


what is the certificates in biztalk?

1431


what is the difference between Windows application and Unix application?

2159






How to connect the .accdb database file of microsoft access to the Visual Basic 6.0 forms?

3703


Need provab technical test questions

2393


how many types of operating system are avaliable?

1819


What is the merger sort principle and its time complexity.

640


how pseudo column works?

1723


Tag for turning an image into a hyperlink is

1842


How do i find out the number of parameters passed into function?

2216


what are the topics choosen for jam round for interviews

1162


how do you generate source code for the automatic generation for receipt number

3828


One boy has to climb steps. He can climb 1 or 2 steps at a time. Write a function that will returns number of way a boy can climb the steps. Int WaytoSteps(int n) (eg:- suppose number of steps is n=4 ,the function will return 5 (one-one-one-one ,one-one-two, one-two-one-,two-one-one, two-two)

2999