Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is %Type,%Rowtype?

2268


sample code for data transfer between two r/2 systems and r/3 systems?

1950


Hi All, Can any one please send me the difference between informatica 7i and 8i versions, Thanks in advance. vinod

1981


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

2124


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.

2475


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.

2240


Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.

1084


How to connect the .accdb database file of microsoft access to the Visual Basic 6.0 forms?

4282


< No Frames > tag is used for

2747


What is the merger sort principle and its time complexity.

1139


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

2222


What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?

2268


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?

2373


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.

1685


could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?

1749