Hi: I'm trying to solve a question as it states: "Create a program which determines if a given number a is a common divisor of two other numbers num1 and num2." I am 100% beginner to Java and just started a couple days ago, so most terms discussed feel quite foreign to me, and so i usually need a little extra explaining. This is what I have come up with so far, even though I know it is not right, as i get errors.
/**
* AWT Sample application
*
* @author
* @version 1.00 09/09/10
*/
public class Common_divisor {
public static void main(String[] args) {
int a;
int num2;
int num1;
if (a % num2 = 0 && a % num1 = 0 )
System.out.println("Common Divisor");
else
System.out.println("Not Common Divisor");
}
}
Above is what i have come up with so far. I'm not sure which is the best way going about answering the question, be it by attaching a scanner, using random numbers, etc.
Your help is always appreciated, thanks a ton in advance.