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
in teradata level primary in table level allows duplicates why?
1.what is the vesition managment.
Write a shell program. Enter number of days from keyboard. Find out the number of years, month and days it contains
what is log files in qtp what is use
What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe
please any one pass file aid,xpeditor and endeavor tools
hi, all this is shoba m.c.a . i have learned abap but no oppurtunities right now as fresher , right now i want to learn any course on demand any one pls suggest me good course and institute in hyderabad
what are other resources are needed for this mantis?
what is the similarity between networking devices?
how can we maintain the previous version scripts to new version.
Write a program to find whether a given number is prime or not.
Suppose server object is not loaded into the memory, and the client request for it , what will happen?
Why did you ever become involved in QA/testing?
What is the merger sort principle and its time complexity.
i want to insert textbox value to sql db. i have only one text box but store four values. ple give any one give sample code in asp.net c#..