Write a Pseudo Code to fins the LCM of two given numbers
Answer Posted / khadanga
public class LCM {
public static void main(String a[]){
test(0,9);
}
static void test(int a,int b){
if(a==0 || b==0){
return;
}
int n;
int increment;
if(a>b){
n = a;
increment = a;
}else{
n = b;
increment = b;
}
while(true){
if(n%a == 0 && n%b == 0){
break;
}else if(n > (a*b)){
n = a*b;
break;
}else{
n = n+increment;
}
}
System.out.println("LCM for "+a+" and "+b+" is "+n);
}
}
Is This Answer Correct ? | 3 Yes | 6 No |
Post New Answer View All Answers
Write a program to find whether a given number is prime or not.
1.how to deploy the Maven application in weblogic server? 2.In Real time projects all classes are singleton or some classes only singleton explain? 3.what are the major uses of the designpatterns? 4.explain restful &Soap based services explain?
Colors specified with the notation
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...
can any one suggestion me present which course(except java,.net) has huge demand in the market?
What sysoption determines where the macro facility searches a specific catalog for complied macro?
how much fee for deccan soft institute .how to block seat for sandeep sir class reply soonnnn
Diff between IF and where ?
what is session state?
hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.
Can i please VHDL code for D-Latch with clear input ?? (HINT: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs and Outputs: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;
Explain the types of operations? Draw the figure for shift and rotate operations?
What is the merger sort principle and its time complexity.
what is web configuration file
Tell me the jobs for the MCA Fresher in delhi, Noida..