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

Answer Posted / zain

#include<iostream>
using namespace std;
int LCM(int a,int b);
int main()
{
int a,b;
cout<<" ENTER TWO NUMBER : ";
cin>>a>>b;
cout<<"\n\n LCM : "<<LCM(a,b);
system("pause");
return 0;
}
int LCM(int a,int b)
{
int n;
for(n=1;;n++)
{
if(n%a == 0 && n%b == 0)
return n;
}
}

Is This Answer Correct ?    49 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the diff bw sql direct and jdbc update can't we do select and updating operation in sql direct

1683


What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe

1555


what is the diffrence between software and hardware language?

1826


how to stop execution of step 3 in a job mainframe

1712


How to use string functions in QTP?give some examples

7119






How do you pass variables forwrd to future CECI sessions

4081


Write a shell program where you enter a number which corresponds to K.M. Find out the corresponding values in m, cm, inches, and feet. Hints:- 1 k.m= 1000 m 1 m= 100 cm 1 inches= 2.54 cm. 1 feet= 12 inches

1523


what is log files in qtp what is use

1595


how to convert infix expression to prefix expression?

3829


Hello...has anyone interviewed with Information Management Services(IMS)located in Silver Spring MD??If yes,what can you share about the programming test and the analytical test?

1506


You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)

596


What is Negative testing?

1502


how to fin top two miximum values in sql? not 2nd both max value of 1st and 2nd both have to find out

1492


1. How many jobs can we write in a single file? 2. How many maximum members can exist in a single partition data set(pds) in jcl?

1919


what is difference between object oriented programming structure and object oriented programming system?

1447