# Checking Multiples from arguments?

• 05-16-2013, 08:01 AM
Checking Multiples from arguments?
I have just started learning Java and I recently got a homework question which I'm unsure of how to do.
Firstly, I have to grab a number from the argument.
Then I check if its a multiple of 5 (0 is counted as a multiple of 5).
IF a multiple of 5, I type "it is a multiple of 5"
IF not, I type "it is not a multiple of "5".

Code:

```public class Exercise1 {         public static void main(String[] args) {                 int numToCheck = Integer.parseInt(args[0]);                 for (int multiple = 0; multiple = Math.pow(numToCheck, 5); multiple++) {                         System.out.println(numToCheck + " is a multiple of 5");                         return;                 }                 System.out.println(numToCheck + " is not a multiple of 5");         } }```
So far I have this. When I try to run it in Eclipse, I get the error "Type mismatch: cannot convert from double to boolean."

Can anyone help me?
• 05-16-2013, 09:07 AM
JosAH
Re: Checking Multiples from arguments?
Have a look at the % operator (modulo operator); if a number n is a multiple of 5, then n%5 == 0.

kind regards,

Jos