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
how we can know the funcions available in a class recording java?
what is the filters in biztakk server? where it can use?
How to set on/off a group of indicators in a single statement?
what is the basic and unique feature of dotnet
how to add a new table with variables and thier values into a imported file uisng proc import?
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fit" instead of the number and for the multiples of five print "Bit". For numbers which are multiples of both three and five print "FitBit".
what is web configuration file
how sap is different from other software ?
how pseudo column works?
what is radio button? Plz show code this! how will select radio buttons to go next window Forms? Supose o radio button1 o radio button2 o radio button3 o radio button4 how will coding this? Plz explain this!
Bonjour, svp je veut voir comment envoyer un mail en java et comment changer le droit d'accé d'un fichier en java: de lecture en lecture/écriture et merci d'avance ;)
where is available in this mantis toturials?
Plz sent me in .net 2.0 interview Question & answers?
Difference between views and index in sas programming
HOW TO FIND NUMBER OF TWOS IN N!(N FACTORIAL)??