March 13th, 2013, 12:27 PM
Begginer with Methods
Hey, i have a question involving methods. This program is supposed to take the largest common multiple from 2 numbers. I have no clue if i am on the right track but the main thing i need to know is how to get it to output the number that I get from the "public static int lcm".
public class TestLCM
public static void main(String args)
public static int lcm (int number1, int number2)
int iAdd1 = number1;
int iAdd2 = number2;
for (int iLoop = 1; iLoop <= 100; iLoop++)
number1= number1 + iAdd1;
number2= number2 + iAdd2;
if (number1 == number2) break;
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!