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

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

1658


qtp 9.2 14 days demo version was expired.I uninstalled how to reinstall this again

2789


how to add a new table with variables and thier values into a imported file uisng proc import?

1904


What is the meaning of client-server application. The purpose of Client-Server Application. with description.

2198


Write a program to swap the content of two variables without using a third variable.

1071


kindly send interview materials

1758


What for decision coverage and modified condition decision coverage are used? Wat is the difference between them?

2153


what does mean and stack mean in genral programming?

1913


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

1954


in IBM PC -AT.WAT AT REFERS TO?

1896


Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage

1944


why not instantiating servet using new operator?

1967


Differevce between arrays and array builders?

2144


how to remove header and footer in jcl using sort utility

5556


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

2154