# Thread: unexpected type on a subtraction sign?

1. Member
Join Date
Apr 2010
Posts
4
Rep Power
0

## 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:

Java 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

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?

3. Member
Join Date
Apr 2010
Posts
4
Rep Power
0
I'm sorry, I'll fix that. Thank you for the advice :)

4. Member
Join Date
Apr 2010
Posts
4
Rep Power
0
Even after fixing what you suggested, I still get the same error =\

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

6. Member
Join Date
Apr 2010
Posts
4
Rep Power
0
never mind I got it, thanks again

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•