Write a Pseudo Code to fins the LCM of two given numbers
Answer Posted / mohit
#include <stdio.h>
main()
{
int a,b,n=2,res=1;
printf("Enter two integers : ");
scanf("%d %d",&a,&b);
while((a!=1)||(b!=1))
{
if((a%n==0)&&(b%n==0))
{
a/=n;
b/=n;
res*=n;
}
else if((a%n==0)&&(b%n!=0))
{
a/=n;
res*=n;
}
else if((a%n!=0)&&(b%n==0))
{
b/=n;
res*=n;
}
else if((a%n!=0)&&(b%n!=0))
{
n++;
}
}
printf("\n LCM of a and b is %d",res);
}
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Write a program to show polymorphism.
Please describe an example where you used object orientation in one of your programs.
I am looking for selenium RC online Training in chennai. can any one tell me the best institute
1) How can u create the table?
how can i split string in a textbox in windows appication using C#.net
what is the software to run the GSM gate opener program
19. Given a system that is described with the following equation, X=A+(B.(A̅+C)+C)+A.B.(D̅+E̅) a) Simplify the equation using Boolean Algebra. b) Implement the original and then the simplified equation with a digital circuit. c) Implement the original and then the simplified equation in ladder logic.
hi i am jyoti i have done sap training in sd and master degree in economics have 2 year exp as enduser in (gdms)and 1 year as sd consultant.as contract basis now what i can do for getting job in it industry
hi this is uday i want prepare for nic exam if any one have previous question papers please send me or atlest guide me how to prepare my ID is udaykiran4u@in.com
What is SOLID Principle in Programming Language?
sample and simple coding where we get?
1.what is the vesition managment.
why not instantiating servet using new operator?
WHAT IS THE MEANING OF CONSTANT ...EXEEDS LENGTH LIMIT WHILE COPYING FROM PS FILE TO KSDS
3 members in a pf.how we read 3 members without using ovrdbf.using rg pgms....