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 are the advantages of sap on other software ?
hi..this is kartheek..complted mca in 2009..but i dont have knowledge in programing..but to learn new language.. which one is suitable for me?is SAP or IBM mainframes is suitable for me..?if it suits how much will it costs..?pls answer...
hai i am prasanna.I am MCA 2009 fresher.tell me about certifications.which certification helps me to improve my carrier and to get a technically oriented job ,which certification helps to get job faster.
Hi..Am done with my Masters recently..Am planning to learn TIBCO.. could anyone suggest me about how the job market will be and Is there any course necessary to learn prior to Tibco..i mean any prerequisite. I dnt have any knowledge on PL/SQL thats it... Plz suggest me in a best way...
Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.
Hi All, Can any one please send me the difference between informatica 7i and 8i versions, Thanks in advance. vinod
Difference between debugging, running, executing of an application
write a sql qwery which include joining of two tables 4 marks mainframe
You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?
what will we require to build project with the help of oracle
what is log files in qtp what is use
design a counter with the following repeated binary sequence: 0, 1, 2, 3, 4, 5, 6, 7, 8 using JK Flip Flop.
can any one suggestion me present which course(except java,.net) has huge demand in the market?
what is the last ant version you worked?how to get it
Code for display the images from drive using vb 6.0?