loops - Java java.lang.ArithmeticException finding multiples of a number -


I am trying to find multiples of the numbers being inputted, but every time the user enters 0 I Get the error. Exception in the / p>

  thread "main" java.lang.ArithmeticException: / by zero  

Yes, I know that you can not divide by zero, but Should be a

  public static int prob1Rec (int num1, int num2) {int sum} This is the way to work.  

= 0; {If ((i% num1 == 0)} (i% num2 == 0)} {sum + = i; for int i = 1; i & lt; 500; i ++) }} Refund Amount; }

Note: If a number is zero, then I still want to add multiples of second number.

if you enter if to

  Can change (if (1 point! = 0 & amp; i% Num1 == 0) || (num2! = 0 & amp; i% num2 == 0)) { 

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -