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
What is %Type,%Rowtype?
sample code for data transfer between two r/2 systems and r/3 systems?
Hi All, Can any one please send me the difference between informatica 7i and 8i versions, Thanks in advance. vinod
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
Given: coordinates of rectangle-> left bottom and right top points. the rectangles create a hole.Find the maximum area of the hole. eg. 4 rectangles create a hole in between. find its area.
A good website has the following conditions It should be interactive. It should contain at least 20 images. Title cannot be null and should contain at least 10 letters other than spaces and hyphen (-). The keywords should contain atleast three among the following list : "design", "Graphics", "lovely", "beautiful", "amazing" and "mesmerising" Write a method: boolean isGoodWebsite(boolean isInteractive, int numOfImages, String title,String keywords[]) isInteractive whether the site is interactive or not numOfImages Number of images on the website title Title of the website keywords Array of keywords in the website.
Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.
How to connect the .accdb database file of microsoft access to the Visual Basic 6.0 forms?
< No Frames > tag is used for
What is the merger sort principle and its time complexity.
how do u handle table control inbdc explain the process in steps iwant the answer in urgent please forward this even i know how to explain there
What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?
how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?
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.
could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?