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 the a cl program with the following specification A. Accept 2 parameters-date and date type B. if date type is J then convert date to *MDY format C. if date type is M convert date to *JUL format 4.send a program message with the value of converted date Please explain for each with coding?
Colors specified with the notation
why we use abstract word in abstract window toolkit in java language.
how can i create report in abap to insert data in table pa0002 using insert command
Write a program to find factorial of a number using functions
1. Write a program to create a sentence at runtime and count number of vowels in it ? 2. Write a program to get a string and to convert the 1st letter of it to uppercase ?
Is anyone has done the ASP.NET MVC4 workshop course(2 days) from Peers Technologies. Let me know. I need to talk before joining ASP.NET MVC4 training at peers, Hyderabad.
4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?
HOW TO FIND NUMBER OF TWOS IN N!(N FACTORIAL)??
what is the work of 1tier,2tier,&ntier? Plz Explain it!
5.Call by value and Call by reference with program?
What do you understand by modular programming?
Definition of Singleton Class? what is the Purpose of it? what is the advantage?
what is programmable BIST in today ic design
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.