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
i am getting the error while compiling my cics program with including db2 dclgen member it is showing that ur dclgen member not including and all the host variables are undeclared
qtp 9.2 14 days demo version was expired.I uninstalled how to reinstall this again
how to add a new table with variables and thier values into a imported file uisng proc import?
What is the meaning of client-server application. The purpose of Client-Server Application. with description.
Write a program to swap the content of two variables without using a third variable.
kindly send interview materials
What for decision coverage and modified condition decision coverage are used? Wat is the difference between them?
what does mean and stack mean in genral programming?
sample code for data transfer between two r/2 systems and r/3 systems?
in IBM PC -AT.WAT AT REFERS TO?
Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage
why not instantiating servet using new operator?
Differevce between arrays and array builders?
how to remove header and footer in jcl using sort utility
If i have a dataset queried from Sql and I would like to insert the dataset into a specific node in an xml document how do I do this