# unexpected type on a subtraction sign?

• 04-22-2010, 03:20 AM
JanieRae
unexpected type on a subtraction sign?
I am trying to make a program that runs through the numbers 0-100 and finds all the values that could stand in as x,y, or z in this equation:

4x + 3y - 9x = 5

Here's what i have:

Code:

```/**  * AWT Sample application  *  * @author: JanieRae  * @version 1.00 10/04/20  */ public class XYZ {         public static void main(String[] args) {               int x = 1;       int y = 1;       int z = 1;               for (x=1;x<100;x++)             {             for (y=1;y<100;y++)                 {             if ((4*x)+(3*y)-(9*z)=5);                                 System.out.println("4*"+x+"+3*"+y+"-9*"+z+"=5");             for (z=1;z<100;z++)                   {                   }                 }             }         }     }```
The only error I get is "unexpected type"
when i go to the detailed build report it says:

"unexpected type
required: variable
found : value
if ((4*x)+(3*y)-(9*z)=5);
^
1 error

Process completed."
(the arrow is underneath the subtraction sign)
but it's a subtraction sign... can someone please tell me what i'm doing wrong?

Thanks
-JanieRae
• 04-22-2010, 03:26 AM
Fubarable
2) Your code is messing up on having a single = in the if boolean statement (an assignment operator) rather than a double == operator.
3) You really really don't want that semicolon after the if boolean check as it will short-circuit your code. Bad.
4) Are you sure you want the if where it's located and not within the inner z loop?
• 04-22-2010, 03:59 AM
JanieRae
I'm sorry, I'll fix that. Thank you for the advice :)
• 04-22-2010, 04:04 AM
JanieRae
Even after fixing what you suggested, I still get the same error =\
• 04-22-2010, 04:06 AM
Fubarable
Quote:

Originally Posted by JanieRae
Even after fixing what you suggested, I still get the same error =\